goku200 Posted March 25, 2022 Share Posted March 25, 2022 (edited) I am trying to hit the Return key without having to use the Send keys. I have the following code and its not hitting the Return key. Am I missing something? ; Press Return $sAction = '{"actions":[{"type": "key", "id": "keyboard_1", "actions": [{"type": "keyDown", "value": "\uE006"},' ; Pause $sAction &= '{"type": "pause", "duration": 500},' ; Release Return $sAction &= '{"type": "keyUp", "value": "\uE006"}]}]}' _WD_Action($sSession, "actions", $sAction) Edited March 25, 2022 by goku200 Link to comment Share on other sites More sharing options...
Danp2 Posted March 25, 2022 Share Posted March 25, 2022 Did you try the example posted here? daledale 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
goku200 Posted March 25, 2022 Author Share Posted March 25, 2022 Hey @Danp2 thanks for that link. I incorporated that into my script. Actions works as expected on other scenarios but it does not work when the print dialogue box appears in Chrome. Its not activating the Actions. My script just hangs when the Google print options are activated: __WD_Post: URL=HTTP://127.0.0.1:9515/session/c4f5cc7baeee1aa9fd871dd5a537e884/actions; $sData={"actions": [{"type": "key", "id": "keyboard", "actions": [{"type": "keyDown", "value": "\ue007"}, {"type": "keyUp", "value": "\ue007"}]}]} __WD_Post ==> Success (0) HTTP status = 200 : ResponseText={"value":null}... Link to comment Share on other sites More sharing options...
Danp2 Posted March 25, 2022 Share Posted March 25, 2022 Hi @goku200, Knowing that you are dealing with the print dialog is an important detail that you failed to initially disclose. Next time, please provide more details in your initial post so that we can better assist you. This dialog isn't controllable via Webdriver, so you'll need to do one of the following -- Use standard Autoit commands to perform the desired action Find a way to accomplish your task without triggering the Print dialog It's difficult to make further recommendations without knowing more about your situation. HTH, Dan Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
goku200 Posted March 25, 2022 Author Share Posted March 25, 2022 (edited) My apologize. So my script basically clicks on a link that opens up the Google Chrome print options And am trying to send the actions by just clicking the enter key. Works fine when I use the Send key, but it requires to have that window focused at all times. Edited March 25, 2022 by goku200 Link to comment Share on other sites More sharing options...
Danp2 Posted March 25, 2022 Share Posted March 25, 2022 You will have to determine the code being executed when you click the link. If it is simply printing the current page, then you may want to take a look at the function _WD_PrintToPDF. 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