X
X
xenofobius2017-08-20 21:12:31
Python
xenofobius, 2017-08-20 21:12:31

How does implicit wait work in selenium for python?

Used this tutorial. I'm trying to set an implicit wait for an element

driver = webdriver.Chrome()
driver.implicitly_wait(10)
driver.get('some_url')
user_name = driver.find_element_by_id('some_id')

But I can’t find the element, it turns before loading, if I do this, then everything works:
wait = WebDriverWait(driver, 10)
wait.until(EC.element_to_be_clickable((By.ID,'some_id')))

How can I set a wait for all items to load?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Bjornie, 2017-08-20
@Bjornie

ksenofobius It is possible that the element is NOT VISIBLE, which means it is in the DOM, but it is visually outside the working screen, so you cannot click on it. Or another situation when another element appears on top of the desired element. These are all examples from practice that I had to deal with.
See options for EC, there are many of them and choose according to the situation. Look in the DOM, the element may not have appeared yet. By the way, with implicitly_wait, I had a similar situation, and although I set it at the beginning of the program, where necessary, I still use wait or even sleep.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question