Scenarion: After clicking New button it will be disable and then need to input the data in field Name text field. It works in Mozilla but not in IE.
IE version -8 IEDriver -IEDriverServer_x64_2.44.0
Scenarion: After clicking New button it will be disable and then need to input the data in field Name text field. It works in Mozilla but not in IE.
IE version -8 IEDriver -IEDriverServer_x64_2.44.0
try to use alternative CSS selector approach because:
More details on performance comparison you can get here
After you start make any actions on the webElements also it better to wait until the whole page renders. Here are some tricks that would help you:
1) waitForPageLoad()
method:
public void waitForPageLoad(WebDriver driver_) {
Wait<WebDriver> wait = new WebDriverWait(driver_, 30);
wait.until(new Function<WebDriver, Boolean>() {
public Boolean apply(WebDriver driver) {
return String
.valueOf(((JavascriptExecutor) driver).executeScript("return document.readyState"))
.equals("complete");
}
});
}
2) fluentWait method -An implementation of the Wait interface that may have its timeout and polling interval configured on the fly.
public WebElement fluentWait(WebDriver driver, final By locator) {
Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
// .pollingEvery(5, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS)
// .ignoring(NoSuchElementException.class);
.ignoring(org.openqa.selenium.NoSuchElementException.class);
WebElement foo = wait.until(
new Function<WebDriver, WebElement>() {
public WebElement apply(WebDriver driver) {
return driver.findElement(locator);
}
}
);
return foo;
}
once you add these methods you can use following calls:
// css selector of the input field:
String cssSelectorInput="blablabla"
waitForPageLoad(driver);
WebElement input= fluentWait(driver, By.cssSelector(cssSelectorInput));
input.sendKeys("test name");
..... etc
Hope this helps you.