Selenium无法在IE浏览器中识别新打开的窗口

时间:2016-05-04 15:35:31

标签: java selenium selenium-webdriver webdriver internet-explorer-9

我无法在我的应用程序中识别新打开的窗口。

当我尝试点击任何对象时使用driver.get("我的应用程序URL")后,我收到org.openqa.selenium.NoSuchWindowException:无法在关闭窗口中找到元素。 我使用以下代码在flipkart网站上复制了同样的问题:

System.setProperty("webdriver.ie.driver","path to IEDriverServer.exe);    

WebDriver driver = new InternetExplorerDriver();          

driver.get("https://www.flipkart.com");

Thread.sleep(10000); // just for sample 

driver.findElement(By.linkText("24x7 Customer Care")).click();

但是当我运行它时,我得到NoSuchWindowException。 它在chrome和Firefox浏览器中运行良好。

Selenium Version = 2.53.0, OS = Windows7

我尝试添加ignoreProtectedMode和IntroduceFlakinessByIgnoringSecurityDomains功能,但即便如此。

请帮忙。

1 个答案:

答案 0 :(得分:0)

使用此功能适合您

System.setProperty("webdriver.ie.driver", "path to IEdriverServer.exe" ); 
WebDriver driver =new InternetExplorerDriver(); 
driver.manage().window().maximize();
driver.get("https://www.flipkart.com");
相关问题