How to set selenium to process the next url when the current one loads more than 30 seconds?
<p>I want to know what to put into exception condition. I'm currently using the pass statement, but I'm not sure whether it does exactly what I want it to do. The reason why I want to implement this is because some webpages takes more than 30 seconds to load completely, like: taobao.com. My code is as followed:</p>

<pre><code>from selenium import webdriver 
from time import sleep 
from selenium.webdriver.support.ui import WebDriverWait 
from selenium.common.exceptions import WebDriverException

profile = webdriver.FirefoxProfile() 
profile.add_extension(extension = '/Users/wayne/Desktop/fourthparty/extension/fourthparty.xpi') 

driver = webdriver.Firefox(profile)
def scan(cutoff): 
    with open('top-1m.csv', 'r') as f: 
        for num, url in enumerate(f): 
            if (num == 500): 
                return

            url = url.split(',')[1] 
            driver.get('http://www.' + url) 
            sleep(30) 

            try: 
                driver.set_page_load_timeout(30) 
            except TimeoutException: 
                pass

if __name__ == "__main__": 
    scan(500)
</code></pre>

<p>Here is the new program that gets the next url if the current one has loaded for more than 30 seconds. It may not look as a typical Python program since I'm used to Java.
    from selenium import webdriver
    from time import sleep
    from selenium.common.exceptions import TimeoutException
    import csv</p>

<pre><code>profile = webdriver.FirefoxProfile()
profile.add_extension(extension = '/Users/wayne/Desktop/fourthparty-master/extension/fourthparty-jetpack.1.13.2.xpi')
driver = webdriver.Firefox(profile)

with open('top-1m.csv', 'r') as f:
    reader = csv.reader(f)
    fList = list(reader)

def crawl(cutoff):
    for i in range(0, cutoff):
        try:
            driver.set_page_load_timeout(30)
            getURL(i)
        except:
            pass

def getURL(num):
    url = 'http://www.' + fList[num][1]
    driver.get(url)
    sleep(30)


if __name__ == "__main__":
    crawl(10)
</code></pre>

python selenium