In context of python selenium, I don't quite understand the exact difference of driver.set_page_load_timeout(n)
VS. driver.set_script_timeout(n)
. Both seem to be used interchangeable to set a timeout to load an URL via driver.get(URL)
, but sometimes also together.
Scenario 1:
driver.set_page_load_timeout(5)
website = driver.get(URL)
results = do_magic(driver, URL)
Scenario 2:
driver.set_script_timeout(5)
website = driver.get(URL)
results = do_magic(driver, URL)
How do both scenarios differ? Which situations trigger a timeout in one but not the other scenario?
As per the Selenium-Python API Docs
set_page_load_timeout(n)
andset_script_timeout(n)
both are timeout methods which are used to configure the webdriver instance to abide by during the program execution.set_page_load_timeout(time_to_wait)
set_page_load_timeout(time_to_wait)
sets the amount of time to wait for a page load to complete before throwing an error and is defined as :Here you can find a detailed discussion on
set_page_load_timeout
set_script_timeout(time_to_wait)
set_script_timeout(time_to_wait)
sets the amount of time that the script should wait during anexecute_async_script
(Javascript / AJAX Call) call before throwing an error and is defined as :