Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I searched online, but couldn't find anything about how to stop page loading over a browser using selenium web-driver.

Any idea for the same?

share|improve this question
Can you explain what you mean by 'stop page loading' ? – Phil Kirkham Feb 4 '13 at 18:51
he wants the page to stop loading... – squeemish Feb 4 '13 at 19:13

If you want to simulate the browser's STOP button, this post should help you out

share|improve this answer
yeah! I have gone through that post earlier,but couldn't understand how to really write it... as that was shorthand code. can you help me on that? – CodeLover Feb 5 '13 at 18:10

This might be useful.



JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("return window.stop");
share|improve this answer

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)


This will stop page load after 5 seconds.

share|improve this answer

Here is a function you may call to set the page load timeout you need.

share|improve this answer
Link only answers are not encouraged. Please add the solution part of the link to your answer. – LittlePanda Apr 30 '15 at 11:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.