E
E
Evstolyan2021-04-02 00:49:47
Python
Evstolyan, 2021-04-02 00:49:47

How to track the loading of elements on the site in selenium?

Hello everyone, my problem is that in the course of executing the code, selenium does not have time to load the page, as it already performs click actions. Of course, this ends with the console displaying an error message saying that the element was not found on the page .I tried time.sleep(), but of course that is not a rational option. I ask those who understand the selenium library in python to suggest how to fix this problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MinTnt, 2021-04-02
@MinTnt

As an example

from selenium.webdriver.support.wait import WebDriverWait

WebDriverWait(driver, 300).until(lambda x: x.find_element_by_css_selector('.test'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question