【问题标题】:SocketException when creating new InternetExplorerDriver with Selenium 2.7.0使用 Selenium 2.7.0 创建新的 InternetExplorerDriver 时出现 SocketException
【发布时间】:2011-12-30 01:06:02
【问题描述】:

我正在尝试创建 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 最新版本的太多文档。有什么建议吗?

【问题讨论】:

    标签: c# webdriver selenium-webdriver socketexception


    【解决方案1】:

    如果您使用的是最新版本的 Selenium (selenium-webdriver),则出现 SocketException,因为您的代码无法连接到默认端口上的 Selenium 服务器(我相信是 4444)。这可能是因为您尚未启动 selenium 服务器(以 jar 文件的形式出现 - 请参阅 Selenium 主页),或者可能有另一个应用程序正在使用您尝试连接的同一端口。

    【讨论】:

      猜你喜欢
      • 2020-03-03
      • 1970-01-01
      • 2010-12-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-05
      • 1970-01-01
      相关资源
      最近更新 更多