Redirect immediately with SELENIUM PYTHON

0

I make a login and login but redirect me to a page which has errors and remains loading. The credentials are kept even if the page does not load completely.

The page has a loop that keeps reloading the site.

After the start of the session, I redirect it to another functional link but I have to wait 1 minute for the previous page to unlock.

Someone knows how to redirect immediately.

I use as a phantomjs driver.

    
asked by Diego Lopez 27.11.2017 в 16:49
source

1 answer

1

For my case it was a website error, a loop class was generated.

To solve this, import the following:

from selenium.common.exceptions import TimeoutException

So I established a time limit to load the page with the following line:

browser.set_page_load_timeout(2)

And control the error if it happened of the time that I assign it like this:

try:
    login_attempt = browser.find_element_by_name("loginButton2").click()
    pass    
except TimeoutException:
    pass
    
answered by 27.11.2017 / 20:59
source