I / O异常和无法找到元素在IE中使用Selenium Webdriver [英] I/O Exception and Unable to find element In IE using Selenium Webdriver

查看:112
本文介绍了I / O异常和无法找到元素在IE中使用Selenium Webdriver的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下代码适用于Firefox和Chrome,但在IE中执行时显示错误。

  System.setProperty(webdriver .ie.driver,G:\\\Selenium\\\IEDriver\\\IIririverServer.exe); 
WebDriver driver = new InternetExplorerDriver();
driver.get(https://www.google.co.in/?gws_rd=cr&ei=ZDziUrLDEuLpiAeD44H4BA);
driver.findElement(By.name(q))。sendKeys(Selenium);

显示的错误是 I / O异常(java.net.SocketException)处理请求时捕获:软件导致连接中止:recv failed
2014年1月24日3:44:04 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute
INFO:重试请求
线程中的异常mainorg.openqa.selenium.NoSuchElementException:

解决方案

问题出在我的IE设置。当IE中的安全设置更改为Internet,本地Intranet,受信任的站点和受限站点的启用保护模式时,问题已解决。您可以通过访问Internet选项安全选项卡并启用所有区域的复选框启用保护模式来更改它。我可以从链接 http://获取这些信息jㄧans ans usic

The below code works fine with Firefox and chrome but shows errors when executed in IE.

System.setProperty("webdriver.ie.driver", "G:\\Selenium\\IEDriver\\IEDriverServer.exe");
    WebDriver driver=new InternetExplorerDriver();
    driver.get("https://www.google.co.in/?gws_rd=cr&ei=ZDziUrLDEuLpiAeD44H4BA");
    driver.findElement(By.name("q")).sendKeys("Selenium");

The error displayed is I/O exception (java.net.SocketException) caught when processing request: Software caused connection abort: recv failed Jan 24, 2014 3:44:04 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute INFO: Retrying request Exception in thread "main" org.openqa.selenium.NoSuchElementException:

The problem was with my IE settings. The problem was resolved when the security settings in IE was changed to "Enable Protected Mode" for "Internet", "Local Intranet", "Trusted Sites" and "Restricted Sites". You can change it by going to Internet Options security tab and enable check box "Enable Protected Mode" for all the zones. I was able to get these information from the link http://jimevansmusic.blogspot.in/2012/08/youre-doing-it-wrong-protected-mode-and.html

这篇关于I / O异常和无法找到元素在IE中使用Selenium Webdriver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆