2

I want selenium to open page and wait for keypress, based on key pressed script should do different actions. It seems there is no Expected Conditions for this case, how can I write my own?

Here is pseudo code:

driver.get('http://google.com')
# wait for keypress
# if keypress == ARROW_RIGHT:
#     print "ARROW_RIGHT"
# elif keypress == ARROW_LEFT:
#     print "ARROW_LEFT"
noobz
  • 33
  • 1
  • 3

1 Answers1

1

You will need to use a python method to check for a key press input. There are different ways to do this depending on if you are using a GUI support library or not. Take a look at this answer, which covers multiple ways on how to work with key presses.

After you detected a key press you can continue performing your task in Selenium.

Community
  • 1
  • 1
DJanssens
  • 17,849
  • 7
  • 27
  • 42
  • 1
    This seems like the right answer to accept. I don't claim to have a full overview of seleniums API, but bear in mind that it is an automatic testing library, and that manual inputs are probably out of scope. – jumps4fun Jul 07 '15 at 13:28