AI123 Posted December 21, 2020 Share Posted December 21, 2020 (edited) I have an input field which is preallocated with suggestion values and I can type in my own values. The values I type in are automatically separated if I type "," or enter after the value. This is the field: Tags are deleted if I click on them. They are also deleted if I click after the last tag and then click Backspace. Every backspace deletes one tag. The problem is that I only want to use my own values. So I have to delete the preallocated values. I tried to delete the preallocated values this way: ;this clear doesn't work: ;/html/body/div/div[1]/ui-view/div/div/div/div/div/div[2]/div[1]/div/div[3]/div $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, _ "//div/div[1]/ui-view/div/div/div/div/div/div[2]/div[1]/div/div[3]/div") _WD_ElementAction($sSession, $sElement, "clear") Sleep(500) ;this clear also doesn't work: ;/html/body/div/div[1]/ui-view/div/div/div/div/div/div[2]/div[1]/div/div[3] $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, _ "//div/div[1]/ui-view/div/div/div/div/div/div[2]/div[1]/div/div[3]") _WD_ElementAction($sSession, $sElement, "clear") Sleep(500) ;go into the input field ;/html/body/div/div[1]/ui-view/div/div/div/div/div/div[2]/div[1]/div/div[3]/div/div[1]/span/div/div/input $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, _ "//div/div[1]/ui-view/div/div/div/div/div/div[2]/div[1]/div/div[3]/div/div[1]/span/div/div/input") ;delete of tags doesn't work: ;I don't need tag q. I set it only to be after the last tag. ;New tags are automatically set after the last tag ;I try to go to the end of all tags and the press backspace until all tags are deleted _WD_ElementAction($sSession, $sElement, "value", "q"); -> works value is set Sleep(500) For $g = 1 To 25 ;Console Output: _WD_ElementAction ==> Invalid data type: (Name|Rect|Text|Selected|Enabled|Displayed|Active|Attribute|Property|CSS|Clear|Click|Value|Screenshot) $sCommand=>key _WD_ElementAction($sSession, $sElement, "key", "{BACKSPACE}") Sleep(500) Next ;this also doesn't work: _WD_ElementAction($sSession, $sElement, "clear") Sleep(500) This is the html structure: So is there a way to delete the preallocated tags from the field? Edited December 21, 2020 by AI123 Link to comment Share on other sites More sharing options...
Danp2 Posted December 21, 2020 Share Posted December 21, 2020 2 hours ago, AI123 said: So is there a way to delete the preallocated tags from the field? I'm sure it can be done, but not with the limited information supplied. I would need access to the website or details on the library that implements the element. AI123 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Nine Posted December 21, 2020 Share Posted December 21, 2020 To send a backspace try this : $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE003"}, {"type": "keyUp", "value": "\uE003"}]}]}' _WD_Action($sSession, "actions", $sAction) AI123 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
AI123 Posted December 21, 2020 Author Share Posted December 21, 2020 25 minutes ago, Danp2 said: I'm sure it can be done, but not with the limited information supplied. I would need access to the website or details on the library that implements the element. The website is spreadshirt . de. I have an account there. It can only be tested with an account there. The solution by Nine works, so I don't need further help for this. But thank you for your effort. Link to comment Share on other sites More sharing options...
AI123 Posted December 21, 2020 Author Share Posted December 21, 2020 (edited) 31 minutes ago, Nine said: To send a backspace try this : $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE003"}, {"type": "keyUp", "value": "\uE003"}]}]}' _WD_Action($sSession, "actions", $sAction) Thank you, that works. 🙂 Is it right that the action will be done on the Window/field that has the focus? So if I have an text editor additionally open and click on it the backspace would be done there instead of the browser? Edited December 21, 2020 by AI123 Link to comment Share on other sites More sharing options...
Nine Posted December 21, 2020 Share Posted December 21, 2020 1 hour ago, AI123 said: Is it right that the action will be done on the Window/field that has the focus? No the backspace will always be performed on the opened Chrome session no matter what window has the focus. AI123 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
AI123 Posted December 21, 2020 Author Share Posted December 21, 2020 18 minutes ago, Nine said: No the backspace will always be performed on the opened Chrome session no matter what window has the focus. Oh, that's good. Thank you for the information. Link to comment Share on other sites More sharing options...
VodkaDiva Posted March 17, 2021 Share Posted March 17, 2021 Chào @Nine . I also had a similar situation. I have tried many ways but it failed. Hope you can help me. I can't remove value in input . but when i left click to input before code run => then it will be deleted . <input name="quantity-input" id="quantity_retail-input" required="" value="14897292522770823" class="wt-input " aria-describedby="quantity_retail-help" aria-invalid="true"> I have use your code to click before remove value but it don't work . $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown"}, {"type": "keyUp"}]}]}' _WD_Action($sSession, "actions", $sAction) $sElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, "//input[@id='quantity_retail-input']") _WD_ElementAction($sSession, $sElement, "clear") thanks nine xxxxxxxxxxx Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now