0

Here is my code:

for i in patient:
    patientFind.send_keys([i])

patientFind.send_keys(Keys.ARROW_DOWN)
patientFind.send_keys(Keys.ENTER)

so there is this text box where I need to individually input the letters and a drop down menu appears as each letter is put in the text box.

Unfortunately after that for loop end there is a tiny bit of delay in the drop box selection so it ends up clicking the wrong thing.

Is there a way to make selenium wait a few seconds between key presses? How do I make it so that selenium would wait 1 or 2 seconds after it completes that for loop before it goes on to press the down arrow?

Of course I can use time.sleep(5), however is there any better way of doing it using webdriver?

kenorb
  • 155,785
  • 88
  • 678
  • 743
Halcyon Abraham Ramirez
  • 1,520
  • 1
  • 16
  • 17
  • you are right I guess that's what I was looking for. Thank you very much – Halcyon Abraham Ramirez Apr 30 '15 at 05:04
  • I think this question is about Selenium, so it shouldn't be duplicated to general question about sleep(), as webdriver has its own methods specially for the tests, such as [`WebDriverWait(driver, timeout)`](http://stackoverflow.com/a/21906199/55075). There is similar question for [Java](http://stackoverflow.com/q/12858972/55075) which wasn't closed as duplicated of another general one. – kenorb May 21 '15 at 22:45
  • Another answer: [`driver.implicitly_wait(30)`](http://selenium-python.readthedocs.org/en/latest/waits.html). – kenorb May 21 '15 at 23:16
  • Similar: [When to use explicit wait vs implicit wait in Python selenium webdriver?](http://stackoverflow.com/q/10404160/55075) – kenorb May 21 '15 at 23:20

0 Answers0