I searched online, but couldn't find anything about how to stop page loading over a browser using
Any idea for the same?
If you are using firefox then you can set preference for default timeout:
fp = webdriver.FirefoxProfile() fp.set_preference("http.response.timeout", 5) fp.set_preference("dom.max_script_run_time", 5) driver = webdriver.Firefox(firefox_profile=fp) driver.get("http://www.google.com/")
This will stop page load after 5 seconds.
If you want to simulate the browser's STOP button, this post should help you out https://stackoverflow.com/questions/5453423/how-to-stop-the-page-loading-in-firefox-programaticaly
There were a few possible solutions to this over on Stackoverflow on Stop browser load from selenium webdriver.
Here is a function you may call to set the page load timeout you need.