NoSuchElementFound exception. There can also be issues with using CSS selectors in older versions of IE, and with mouse events. This article will provide you with some common tips and tricks for testing against IE with Selenium, as well as some links to additional resources.
Synchronization Issues and WebDriverWait
The best way to deal with synchronization issues is to use one of the WebDriverWait methods in your test script. These allow you to specify a condition within your test, and then wait for that condition to be true before proceeding to the next step. It's also a Sauce Labs recommended best practice to use explicit waits in your tests.
Using CSS Selectors with Older Versions of IE
Current versions of IE support CSS 3 selectors, but versions 7 and 8 only support General Siblings and Attribute selectors. If you need to test against these versions of IE, you will need to use different selectors.
Native Events, Browser Focus, and Mouse Events
- If you attempt to hover over elements and your physical mouse cursor is within the boundaries of the IE browser window, the hover state will appear for an instant and then disappear. There is no known workaround for this behavior.
- If the test involves clicking an
<option>element within a
<select>element, and the
OnChangeevent of the
prompt(), calling WebElement's
click()method will result in a hang until the modal dialog is dismissed. This is because the IE driver normally calculates where to click based on the position and size of an element as returned by the
getBoundingClientRectangle()method, but for
<option>elements this will return a rectangle with zero position and zero size. To counteract this, the driver uses the
click()Automation Atom instead of a native event to set the
.selectedproperty of the
<option>element and simulate the
- Internet Explorer Driver Documentation at SeleniumHQ
All the most up-to-date documentation for the IE Driver, along with a download link and configuration information
- Test Talks Podcast #28: Jim Evans with Secrets on How to Succeed with Selenium and IE
Joe Colantonio in conversation with Jim Evans, developer of the .NET bindings for Selenium and the IE Driver, sponsored by Sauce Labs
- Selenium and IE - Getting Them to Work Together
A summary blog post of Joe Colantonio's conversation with Jim Evans