R
R
Rudy99662022-01-04 17:38:03
selenium
Rudy9966, 2022-01-04 17:38:03

How to make ignore in selenium?

I have a cycle

error = driver.find_element_by_id("error-title").is_selected()
    print(error)
    time.sleep(5)
    while error == False:
        print("Йобанный полигон за 2 рубля")
        time.sleep(2)
        driver.refresh()
        time.sleep(5)
        driver.find_element_by_xpath("//div[@id='welcome']/div/span").click()
        time.sleep(30)
        error = driver.find_element_by_id("error-title").is_selected()

When the element is not found, the work stops and the following error pops up
Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="error-title"]"}


How can you write that if the element was not found, then the work continued?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question