CaptainBeardsEyesBeard Posted December 1, 2020 Share Posted December 1, 2020 (edited) Hi How can I send an "enter" command to an xpath using WD element action? I tried the below but it just sends "\uE006" to the search bar _WD_ElementAction($sSession,$SearchXpath,'value',"\uE006") https://w3c.github.io/webdriver/#keyboard-actions Edited December 1, 2020 by CaptainBeardsEyesBeard Link to comment Share on other sites More sharing options...
Gianni Posted December 1, 2020 Share Posted December 1, 2020 (edited) ... something like this: ; https://w3c.github.io/webdriver/#keyboard-actions _WD_ElementAction($sSession, $oElement, 'value', $sValue & "\uE006") for other keycodes see here: https://w3c.github.io/webdriver/#keyboard-actions Edited December 1, 2020 by Chimp Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted December 1, 2020 Author Share Posted December 1, 2020 #I just tried this and it resulted in "$Value "\uE006"" being inserted into the search bar Also tried changing the 'value' to 'key' but that didn't work either _WD_ElementAction($sSession,$SearchXpath,'key',"\uE006" Link to comment Share on other sites More sharing options...
Gianni Posted December 1, 2020 Share Posted December 1, 2020 (edited) . ..only seen now that you edit OP. instead of passing the xPath string directly into the second parameter ($SearchXpath), first search for the target object using the command: $oGotElement = _WD_FindElement( ... ), and then pass the returned value to the second parameter of the _WD_ElementAction: _WD_ElementAction($sSession, $oGotElement, 'value', $sValue & "\uE006") Edited December 1, 2020 by Chimp changed variable name to $oGotElement Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
CaptainBeardsEyesBeard Posted December 1, 2020 Author Share Posted December 1, 2020 OK I tried this but it seems to error as I get the msgbox come up $GotElement = _WD_FindElement($sSession, $_WD_LOCATOR_ByXPath, '/html/body/particle-toolbar/mat-toolbar/div[1]/div[1]') _WD_ElementAction($sSession,$GotElement,'key',"\uE006") If @error Then MsgBox(64, "Debug", "Error sending key enter.") EndIf Link to comment Share on other sites More sharing options...
Gianni Posted December 1, 2020 Share Posted December 1, 2020 try to change 'key' with 'value' Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Danp2 Posted December 1, 2020 Share Posted December 1, 2020 @CaptainBeardsEyesBeard You should get in the habit of reviewing the Scite output log to identify why your code is failing. 😉 P.S. This question was also previously asked / answered here Latest Webdriver UDF Release Webdriver Wiki FAQs 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