Error after redirection - "cannot determine loading status"

Viewed 220

I need some help with Selenium/PyCharm. After switching to a new PC, the code that used to work fine began to break when searching for a button and clicking on it. Interesting thing: problem arise only on this button, i would say even on redirection. if you skip this step, everything works perfectly.

driver.find_element(By.ID, "phone").send_keys("0991041337")
driver.find_element(By.NAME, "password").send_keys("Login123")
button_login = driver.find_element(By.ID, "submit-login").click()
time.sleep(1)

A screenshot of the error is here

I will be very grateful if someone can help me :)

1 Answers

There's a relatively new Selenium bug where cannot determine loading status appears, even though the click was successful. This will get around your issue:

driver.find_element(By.ID, "phone").send_keys("0991041337")
driver.find_element(By.NAME, "password").input2_pw.send_keys("Login123")
button_login = driver.find_element(By.ID, "submit-login")

from selenium.common.exceptions import WebDriverException

try:
    button_login.click()
except WebDriverException as e:
    if "cannot determine loading status" in e.msg:
        pass  # Odd issue where the click did happen. Continue.
    else:
        raise e

I'm the maintainer of SeleniumBase, so I patched the issue directly in https://github.com/seleniumbase/SeleniumBase/issues/1374

Related