使用 Selenium 2.7.0 创建新的 InternetExplorerDriver 时出现 SocketException
我正在尝试创建 Selenium InternetExplorerDriver 的新实例来运行简单的测试,并且收到以下异常消息:
SocketException occurred
No connection could be made because the target machine actively refused it ::1:56335
此时它到底试图连接到什么?我尝试使用以下代码为驱动程序设置代理设置,但仍然收到相同的错误:
var proxy = new Proxy { ProxyAutoConfigUrl = "http://myworkproxy.removed.com:1234" };
var capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability(CapabilityType.Proxy, proxy);
driver = new InternetExplorerDriver(capabilities);
我进行了搜索,但找不到最新版本 Selenium 的太多文档。有什么建议吗?
I'm trying to create a new instance of the Selenium InternetExplorerDriver to run a simple test and I'm receiving the following exception message:
SocketException occurred
No connection could be made because the target machine actively refused it ::1:56335
What exactly is it trying to connect to at this point? I've tried setting proxy settings for the driver with the following code but still receive the same error:
var proxy = new Proxy { ProxyAutoConfigUrl = "http://myworkproxy.removed.com:1234" };
var capabilities = DesiredCapabilities.InternetExplorer();
capabilities.SetCapability(CapabilityType.Proxy, proxy);
driver = new InternetExplorerDriver(capabilities);
I've had a search but can't find much documentation for the latest version of Selenium. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是最新版本的 Selenium (selenium-webdriver),则会发生 SocketException,因为您的代码无法在默认端口(我认为是 4444)上连接到 Selenium 服务器。这可能是因为您尚未启动 selenium 服务器(以 jar 文件形式提供 - 请参阅 Selenium 主页),或者可能有另一个应用程序正在使用您尝试连接的同一端口。
If you are using the latest version of Selenium (selenium-webdriver), then the
SocketException
occurred, because your code cannot connect to the Selenium Server on the default port (I believe 4444). This might be because you haven't launched the selenium server (comes as a jar file - see the Selenium home page) or there might be another application that is using the same port that you are trying to connect to.