【问题标题】:Why can Selenium GECKO driver for Firefox 48 not start the server?为什么 Firefox 48 的 Selenium GECKO 驱动程序无法启动服务器?
【发布时间】:2016-09-07 15:57:04
【问题描述】:

我们在 .Net 自动化测试项目设置中运行 Selenium 2.5.3 作为 NUnit 测试项目。

在 Firefox 47 上一切正常。但在 Firefox 48 上它停止了工作。 我从 github 下载了 Gecko.exe(版本 9)。 我几乎可以让它运行,但不完全。

我收到以下错误: 附加信息:对 URL http://localhost:53628/session 的远程 WebDriver 服务器的 HTTP 请求在 30 秒后超时。

附加信息:对 URL http://localhost:55924/session 的远程 WebDriver 服务器的 HTTP 请求在 30 秒后超时。

似乎默认是使用随机端口。 所以我手动将其设置为端口 7500,在 Windows 防火墙中打开该端口,现在我得到了这个: 附加信息:无法在http://localhost:7500/ 上启动驱动程序服务

这是我在 WebDriverFactory 中的代码:

case WebDriverType.Firefox:
                Log.Info("Starting Firefox ...");

                //string driverPath =
                //    $"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)}\\wires.exe";

                string driverPath =
                    @"C:\Development2\iRePORT\src\test\csharp\Nete.Ireport.EndToEndTests\bin\Debug\geckodriver.exe";

                FirefoxDriverService driverService = FirefoxDriverService.CreateDefaultService();
                driverService.FirefoxBinaryPath = driverPath;
                driverService.Port = 7500;

                FirefoxOptions ffOptions = new FirefoxOptions();
                ffOptions.IsMarionette = true;
                driver = new FirefoxDriver(driverService, ffOptions, TimeSpan.FromSeconds(30));

                // driver = new FirefoxDriver(new FirefoxOptions());

                Log.Info("Started");
                break;

我在这方面花了很多时间,我觉得我很接近。 有谁知道我错过了什么?


我现在读到一些让我想到这一行的东西;

driverService.FirefoxBinaryPath = driverPath;

指向要使用的 Firefox 安装版本。 我现在将驱动程序路径和可执行文件名称放在 driverService 构造函数中,如下所示:

case WebDriverType.Firefox:
                Log.Info("Starting Firefox ...");

                //string driverPath =
                //    $"{Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase)}\\wires.exe";

                string driverPath =
                    @"C:\Development2\iRePORT\src\test\csharp\Nete.Ireport.EndToEndTests\bin\Debug";
                string driverExecutableName = "geckodriver.exe";

                FirefoxDriverService driverService = FirefoxDriverService.CreateDefaultService(driverPath, driverExecutableName);
                // Don't do this!!! This is the executable to the Firefox Version executable.
                //driverService.FirefoxBinaryPath = driverPath;
                driverService.Port = 7500;

                FirefoxOptions ffOptions = new FirefoxOptions();
                ffOptions.IsMarionette = true;
                driver = new FirefoxDriver(driverService, ffOptions, TimeSpan.FromSeconds(30));

                // driver = new FirefoxDriver(new FirefoxOptions());

                Log.Info("Started");
                break;

所以现在我又回到了这个错误: 附加信息:无法在http://localhost:7500/ 上启动驱动程序服务


如果我有: 驱动程序服务端口 = 7200; 它说“找不到实体”。我相信这意味着它找不到 Gecko.exe。 如果我有: 驱动程序服务端口 = 7500; 它说: 附加信息:无法在http://localhost:7500/ 上启动驱动程序服务

【问题讨论】:

标签: c# .net selenium firefox selenium-webdriver


【解决方案1】:

试试 Selenium 3.0.0。我也遇到过这个问题,但我终于管理了从 2.53.1 切换到 3.0.0 的所有东西

【讨论】:

    猜你喜欢
    • 2021-07-01
    • 2018-04-02
    • 1970-01-01
    • 2018-12-31
    • 1970-01-01
    • 2014-03-27
    • 1970-01-01
    • 1970-01-01
    • 2015-08-09
    相关资源
    最近更新 更多