Selenium with Python keeps to load a page
<p>I am trying to read a page using a simple Python/Selenium script</p>

<pre><code># encoding=utf8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import datetime as dt
import codecs
import os

myDriver=webdriver.Chrome()
myDriver.get("http://spb.beeline.ru/customers/products/mobile/tariffs/")
print "Test"
myDriver.quit()
</code></pre>

<p>Now, if i open that url using google chrome, the page load and that's it.
While doing it through this script, the page remains in a load state and the script can't go further.</p>

<p>I'm on Windows 7, using Python 2.7.12, Selenium 2.53.6 and chromedriver 2.24.41.74.31</p>

<p>I'm not sure what that page is doing, but it is certainly atypical. My best suggestion is to set the page load timeout and then handle the associated TimeoutException:</p>

<pre><code># encoding=utf8
from __future__ import print_function

from selenium import webdriver
from selenium.common.exceptions import TimeoutException

myDriver=webdriver.Chrome()

try:
    # Set the page load timeout
    myDriver.set_page_load_timeout(10)
    try:
        myDriver.get("http://spb.beeline.ru/customers/products/mobile/tariffs/")
    except TimeoutException:
        print("Page expired")

    # Do stuff here

finally:
    myDriver.quit()
</code></pre>

<p>The downside is that (I think) this will kill whatever is happening in the back ground that prevents the <code>driver.get</code> call from returning, so some page functionality may be fundamentally broken.</p>

python selenium selenium-chromedriver