When using the IE driver with IE9, occasionally the Click method will only select a button, it wont do the action of the Click(). Note this only happens occasionally, so i d
I resolved problem whith .click() next way. I used JS and executeScript(JS, WebElement el) instead of .click().
Example:
protected void clickForIE(WebElement element){
((JavascriptExecutor)wd).executeScript("var tmp = arguments[0];
tmp.click()", element);
}
But after using this method we should wait while page loading. And that's why I used next method:
protected synchronized void pageWaitLoad() {
String str = null;
try {
str = (String)((JavascriptExecutor)wd).executeScript("return document.readyState");
}
catch (Exception e) {
// it's need when JS isn't worked
pageWaitLoad();
return;
}
System.out.println("ttt " + str);
while(!str.equals("complete")){
try {
Thread.currentThread().sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
str = (String)((JavascriptExecutor)wd).executeScript("return document.readyState");
}
}
You must call pageWaitLoad() every time after clickForIE().