Reputation: 404
Below options are not working. Are there any other options to try with in selenium c# or using JavaScript?
Tried with below statements but still no luck.
driver.findElement(By.tagName("body")).sendKeys("Keys.ESCAPE");
and
driver.execute_script("window.stop();")
driver.findElement(By.tagName("body")).sendKeys("Keys.ESCAPE");
and
driver.execute_script("window.stop();")
Want to stop reload of a web page.
Upvotes: 1
Views: 4764
Reputation: 193208
The Window stop()
Method stops window loading and is the same as clicking on the browser's stop button.
Python:
driver.execute_script("window.stop();");
Java:
((JavascriptExecutor)driver).executeScript("window.stop();");
C#:
((IJavaScriptExecutor)driver).ExecuteScript("window.stop();");
Note: Because of the script execution, this method cannot interrupt its parent document's loading, but it will stop its images, new windows, and other still-loading objects.
Upvotes: 2