Reputation: 246
There is a button on the Webpage that gets pressed when I do SHIFT ENTER (I cannot use Click Element
, as this is a Keyboard function keys test). But the Press Keys
from the SeleniumLibrary (3.3.0)
, seems not working, i mean the button is not getting pressed. I tried following combination keys nothing seem to work.
Press Keys ${None} SHIFT+ENTER
Press Keys ${None} SHIFT+RETURN
Press Keys ${None} SHIFT ENTER
Here is the log trace
KEYWORD Selenium2Library . Press Keys ${None}, SHIFT+ENTER
Documentation:
Simulates user pressing key(s) to an element or on the active browser.
Start / End / Elapsed: 20210424 09:07:57.794 / 20210424 09:07:57.846 / 00:00:00.052
09:07:57.794 TRACE Arguments: [ None | 'SHIFT+ENTER' ]
09:07:57.795 INFO Sending key(s) (u'SHIFT+ENTER',) to page.
09:07:57.795 INFO Pressing special key SHIFT down.
09:07:57.796 INFO Pressing special key ENTER down.
09:07:57.796 INFO Releasing special key SHIFT.
09:07:57.796 INFO Releasing special key ENTER.
09:07:57.796 DEBUG POST http://127.0.0.1:56002/session/7fee5882a08a0a823f6619b52bb6ae7c/actions {"actions": [{"parameters": {"pointerType": "mouse"}, "type": "pointer", "id": "mouse", "actions": [{"duration": 0, "type": "pause"}, {"duration": 0, "type": "pause"}, {"duration": 0, "type": "pause"}, {"duration": 0, "type": "pause"}]}, {"type": "key", "id": "key", "actions": [{"type": "keyDown", "value": "\ue008"}, {"type": "keyDown", "value": "\ue007"}, {"type": "keyUp", "value": "\ue008"}, {"type": "keyUp", "value": "\ue007"}]}]}
09:07:57.846 DEBUG http://127.0.0.1:56002 "POST /session/7fee5882a08a0a823f6619b52bb6ae7c/actions HTTP/1.1" 200 14
09:07:57.846 DEBUG Finished Request
09:07:57.846 TRACE Return: None
I think the problem is with the Sequence. when i tried the same sequence manually, it didn't work
09:07:57.795 INFO Pressing special key SHIFT down.
09:07:57.796 INFO Pressing special key ENTER down.
09:07:57.796 INFO Releasing special key SHIFT.
09:07:57.796 INFO Releasing special key ENTER.
It should've been like this and this way it works manually
09:07:57.795 INFO Pressing special key SHIFT down.
09:07:57.796 INFO Pressing special key ENTER down.
09:07:57.796 INFO Releasing special key ENTER.
09:07:57.796 INFO Releasing special key SHIFT.
Any idea how this can be achieved?
Upvotes: 1
Views: 1880
Reputation: 1198
Try targeting the body tag instead of None
Press Keys xpath://body SHIFT+ENTER
Press Keys xpath://body SHIFT+RETURN
If it still fails you will have to use some other library such as AutoIt or PyAutoGUI.
Upvotes: 1