How to stop a page loading from selenium in chrome?

in selenium
selenium Tutorials
1 Answers to this question

In order to stop a page loading from selenium in chrome, you will need to set the pageLoadStrategy to none. You will also need to wait for the element to be present and call window.stop to stop the loading.

from selenium import webdriver

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

from import WebDriverWait

from import expected_conditions as EC

from import By

capa = DesiredCapabilities.CHROME

capa["pageLoadStrategy"] = "none"

driver = webdriver.Chrome(desired_capabilities=capa)

wait = WebDriverWait(driver, 20)


wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '#h-top-questions')))


If you want to unleash your potential in this competitive field, please visit the Selenium Certification Training page for more information, where you can find the    Selenium Tutorial    and    Selenium Interview Questions FAQ's and answers    as well.

For more updates on the latest courses stay tuned to HKR Trainings.

To Top