对远程 WebDriver 服务器的 URL http://localhost:6444/session 的 HTTP 请求在 60 秒后超时 [英] The HTTP request to the remote WebDriver server for URL http://localhost:6444/session timed out after 60 seconds

查看:53
本文介绍了对远程 WebDriver 服务器的 URL http://localhost:6444/session 的 HTTP 请求在 60 秒后超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在使用 selenium 初始化 Firefox 时遇到问题.这个问题似乎只发生在我的 Windows Server 2012 r2 上,因为我在我的本地机器(Windows 10)上尝试了相同的配置并且它没有问题.

I am currently facing a problem in initializing Firefox in selenium. This issue seems to be only happening to me on Windows Server 2012 r2 as I have tried the same configuration on my local machine (windows 10) and it worked without a problem.

我目前正在使用此代码 (C#):

I am currently using this code (C#):

 FirefoxDriverService service = FirefoxDriverService.CreateDefaultService("Path to Drivers folder", "geckodriver.exe");
                    service.Port = 6444;
                    service.FirefoxBinaryPath = "Firefox installation path";
                    ffDriver = new FirefoxDriver(service);

但是,它返回此错误:

OpenQA.Selenium.WebDriverException:对远程的 HTTP 请求URL http://localhost:6444/session 的 WebDriver 服务器超时后60 秒.---> System.Net.WebException: 操作已超时

OpenQA.Selenium.WebDriverException: The HTTP request to the remote WebDriver server for URL http://localhost:6444/session timed out after 60 seconds. ---> System.Net.WebException: The operation has timed out

正在使用的当前版本:

  • Firefox 56.0 64 位
  • 硒 3.5.1
  • Geckodriver v0.19.0 64 位

有人可以指导我解决这个问题吗?

Can someone please guide me through this issue?

推荐答案

在启动 FirefoxDriver 的代码中添加这个

Add this in code on Launching FirefoxDriver

通过引用这个 答案

  ffDriver=   new FirefoxDriver(new FirefoxBinary(),new FirefoxProfile(),TimeSpan.FromSeconds(120));

这篇关于对远程 WebDriver 服务器的 URL http://localhost:6444/session 的 HTTP 请求在 60 秒后超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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