I am using selenium webdriver (firefox) on Ubuntu + Python, and run into an issue where sometimes the page doesn't load, and the whole script simply hangs.
Is there a way to force-exit the webdriver window after X seconds ?
Looking for code like the one below, that actually works though. It looks like if the webdriver is waiting on the response, it will wait (almost) indefinitely).
driver.get(record)
sleep(5)
my_html = driver.page_source #get whatever we have after 5 sec
driver.close() #close driver
NOTE!: The accepted answer is correct. The issue was caused by my geckodriver being out of date (v 0.11 vs v.019).
To check your version on ubuntu:
geckodriver --version #command in terminal
to update the driver (if needed), use these steps. Note - Sandeep's answer worked best for me.