Reputation: 85
Hello im using webdriver and first time works excellent, but the next day it only works on google chrome with the same code, on IE says that cant find the element and im using a very simple code that is:
public class Test {
public static void main(String[] args) throws InterruptedException {
//WebDriver driver = new InternetExplorerDriver();
WebDriver driver = new ChromeDriver();
driver.get("http://www.google.com");
Thread.sleep(3000);
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("ELTUTO");
}
and the error says:
Exception in thread "main" org.openqa.selenium.NoSuchWindowException: Unable to find element on closed window (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 14 milliseconds Build info: version: '2.33.0', revision: '4e90c97', time: '2013-05-22 15:33:32' System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_25'
Only says that when im exceuting on IE on google chrome works good
Upvotes: 0
Views: 573
Reputation: 6764
It's because you're always creating an instance of WebDriver driver = new ChromeDriver();
If you want to use it on IE then create an instance of WebDriver driver = new InternetExplorerDriver();
Edit
Also, the InternetExplorerDriver needs to be correctly configured for it to work. Please check the required configuration part on the selenium wiki...
Upvotes: 3