[英]Cannot start firefox browser instance for tests using Visual Studio, C#, Nunit and Selenium
I am having troubles trying to run simple UI test in Visual Studio (16.11.10) using C# and NUnit.我在尝试使用 C# 和 NUnit 在 Visual Studio (16.11.10) 中运行简单的 UI 测试时遇到了麻烦。 I am using Selenium.Firefox.WebDriver version 0.27.0., Selenium.WebDriver and Selenium.Support both 4.1.0
我正在使用 Selenium.Firefox.WebDriver 版本 0.27.0., Selenium.WebDriver 和 Selenium.Support both 4.1.0
Test:测试:
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
namespace ClassLibrary2
{
public class Class1
{
[Test]
public static void TestBrowser()
{
IWebDriver driver = new FirefoxDriver();
driver.Url = "https://login.yahoo.com/";
driver.Quit();
}
}
}
Running this test I am getting such error:运行这个测试我得到这样的错误:
TestBrowser
Source: Class1.cs line 10
Duration: 4,6 sec
Message:
OpenQA.Selenium.WebDriverException : Cannot start the driver service on http://localhost:59898/
Stack Trace:
DriverService.Start()
DriverServiceCommandExecutor.Execute(Command commandToExecute)
WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
WebDriver.StartSession(ICapabilities desiredCapabilities)
WebDriver.ctor(ICommandExecutor executor, ICapabilities capabilities)
FirefoxDriver.ctor(FirefoxDriverService service, FirefoxOptions options, TimeSpan commandTimeout)
FirefoxDriver.ctor(FirefoxOptions options)
FirefoxDriver.ctor()
Class1.TestBrowser() line 18
Standard Output:
Unable to connect to the remote server
All works fine using ChromeDriver.使用 ChromeDriver 一切正常。 Thanks for your help.
谢谢你的帮助。
Possibly Selenium.Firefox.WebDriver version 0.27.0 points to the older GeckoDriver of version0.27.0 .可能Selenium.Firefox.WebDriver version 0.27.0指向version0.27.0的旧版GeckoDriver 。 Hence you see the error.
因此您会看到错误。
The solution would be to upgrade to latest version of GeckoDriver ie version0.30.0解决方案是升级到最新版本的GeckoDriver即版本 0.30.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.