OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:20548/'

后端 未结 2 991
你的背包
你的背包 2021-01-23 06:33

I\'m getting the following error when I try to open the EdgeDriver.

OpenQA.Selenium.WebDriverException: \'Cannot start the driver service on http://localhost:20         


        
2条回答
  •  遇见更好的自我
    2021-01-23 06:57

    OpenQA.Selenium.WebDriverException: 'Cannot start the driver service on http://localhost:20548/'

    As for this issue, It could be the case that a process of the WebDriver is still running in the background. Please try to fire up Task Manager to see and end it if does.

    Otherwise, you could try to use the following code to assign the webdeiver server:

            var driverpath = @"C:\Program Files (x86)\Microsoft Web Driver"; //find the web driver path
            var driver = new EdgeDriver(driverpath);
            // Navigate to Bing
            driver.Url = "https://www.bing.com/";
    
            // Find the search box and query for webdriver
            var element = driver.FindElementById("sb_form_q");
    
            element.SendKeys("webdriver");
            element.SendKeys(Keys.Enter);
    
            Console.ReadLine();
            driver.Quit();
    

    This version of MicrosoftWebDriver.exe is not compatible with the installed version of Windows 10.

    Please check this article to download the related Microsoft WebDriver version based on your Edge browser version.

    Then, you could refer to this article to use WebDriver.

提交回复
热议问题