Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium 2: Interrupt a page load

I have an issue when clicking on a button with Selenium 2.0b3 Java API with FirefoxDriver. Clicking on the button sends a form to the webserver and then browser goes to a new page as a result of the form submission.

When clicking on an element with element.click(), selenium is waiting for the browser to complete its operations. The browser waits until the page load is finished. But, sometimes the page load takes an enormous amount of time due to some advertisement requests.

How to work around the synchronisation between element.click() and the page load?

EDIT:

As explained in the WebElement javadoc:

Click this element. If this causes a new page to load, this method will block until the page has loaded.

Thanks

like image 807
djondal Avatar asked Jun 16 '11 23:06

djondal


1 Answers

Try the beta feature only for Firefox listed in the last section of the firefoxdriver wiki page http://code.google.com/p/selenium/wiki/FirefoxDriver

You will need at least version 2.9, I recommend going with the latest 2.18 (2.0b3 is nearly a year old now!)

like image 139
lukeis Avatar answered Oct 07 '22 07:10

lukeis