Reasons of selenium scripts failing when executed in IE


In this post i would like to address common issue faced by selenium automation engineers and that issue is “My script works fine in Chrome and FF but fails in IE ”  . 

Reasons
main reason for scripts failing is IE explorer is slow when it comes to finding elements  . When web driver tries to click an element its not loaded yet in browser .
Solution: 

To counter this problem use the Wait Commands in your code . like e.g when you are going to click a element with id “btn_001” add a line of code before it which waits for this element to load 
Code: 
this line of code would make sure that element is there when its been clicked 
wait.until(ExpectedConditions.presenceOfElementLocated(By.ID("btn_oo1")));
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s