OpenQA.Selenium.WebDriverException:无法在http:// localhost:50343 /上启动驱动程序服务

时间:2019-01-28 13:47:31

标签: c# selenium selenium-webdriver selenium-chromedriver

我尝试从Activity Monitor(Mac)清除Chrome驱动程序,然后重新运行测试。这是行不通的。我已经看到这个问题经常发布,但是到目前为止,所有解决方案都没有起作用,而且都是基于Windows的。我正在使用C#和Visual Studio和Mac。

请参阅下面的堆栈跟踪:

   at OpenQA.Selenium.DriverService.Start()
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)

Please see the browser code below: 

**BROWSER.CS**


public enum Drivers
    { 
        Chrome,

    }
    #endregion

    ** Class containing browser driver setup, URL setup, Waits, find element definition, and browser manipulation methods**

    public static class Browser
    {
        #region Driver Instantiation

        static IWebDriver _webDriver;


        public static ISearchContext Driver { get { return _webDriver; } }


 **Returns the driver executable application**

internal static IWebDriver GetDriver(Drivers driver)
        {
            switch (driver)
            {
                case Drivers.Chrome:

                    return new ChromeDriver(@"/Users/wsmith/Projects/Github/folio-quality-assurance/Folio.Selenium.Framework");

                default:
                    throw new NotImplementedException("I do not know the driver you specified.");
            }
        }
        #endregion

        #region Initialize Browser

**Initializes the webdriver, opens the browser window. This is called in the test fixtures to set up before running the tests**

        public static void Initialize()
        {
            _webDriver = GetDriver(Drivers.Chrome);
            _webDriver.Manage().Window.Maximize();
            Goto("");
        }
        #endregion

        #region URL

0 个答案:

没有答案