Share via


Selenium C# 3.8.0 Firefox and Edge Errors on Office Windows 10 machine

Question

Tuesday, January 30, 2018 6:16 AM

VS 2015 Selenium works fine both in home office and at work with the chrome driver. At Home office, the Firefox and Edge drivers work fine with the following code:

            [Test]
    public void FirefoxTest()
    {
        IWebDriver firefoxDriver = new FirefoxDriver(); //Broken

        firefoxDriver.Navigate().GoToUrl(@"https://www.google.com");
        firefoxDriver.Manage().Window.Maximize();
        firefoxDriver.FindElement(By.Name("q")).Clear();
        firefoxDriver.FindElement(By.Name("q")).SendKeys("selenium \n");
        System.Threading.Thread.Sleep(2000);
        Assert.IsTrue((firefoxDriver.FindElement(By.Id("resultStats")).Text ?? "").Contains("About"));

        firefoxDriver.Close();
        firefoxDriver.Quit();

    }



    [Test]
    public void EdgeTest()
    {
        IWebDriver edgeDriver = new EdgeDriver();
        edgeDriver.Navigate().GoToUrl(@"http://www.google.com");
        edgeDriver.Manage().Window.Maximize();
        edgeDriver.FindElement(By.Name("q")).Clear();
        edgeDriver.FindElement(By.Name("q")).SendKeys("selenium \n");
        System.Threading.Thread.Sleep(2000);
        Assert.IsTrue((edgeDriver.FindElement(By.Id("resultStats")).Text ?? "").Contains("About"));
        edgeDriver.Close();
        edgeDriver.Quit();
    }

At the Office, using VS 2017, Chrome and IE work fine, Firefox and Edge do not. The Firefox driver instantiates and launches the browser, but then locks up and never returns to the calling code. The next line to navigate never gets called.

The Edge driver continues to error with the message OpenQA.Selenium.WebDriverException: Cannot start the driver service on http://localhost:42623.

Both test have been reconfigured incorporating suggested solutions including FirefoxOptions, FirefoxProfile, etc.

Thanks.

Version Info:

Firefox 58.0.1 (64-bit) geckodriver.exe v 0.19.1 – 32 bit geckodriver-v0.19.1-win64 Microsoft Edge 41.16299.15.0 Microsoft EdgeHTML 16.16299 Microsoft WebDriver Release 16299 Version: 5.16299 | Edge version supported: 16.16299 NUnit v3.9.0 Selenium.WebDriver v3.8.0 Selenium.Firefox.Webdriver v0.19.1 Selenium.RC v3.1.0 Windows 10 Pro - Version 1709 - OS Build 16299.192 

All replies (3)

Wednesday, January 31, 2018 5:13 AM

Hi absinc,

Welcome to the MSDN forum.

Do you use Nunit in Visual Studio?

I test the issue use Visual Studio 2017 in my windows 10 machine, it works fine.

>> The Firefox driver instantiates and launches the browser, but then locks up and never returns to the calling code. The next line to navigate never gets called.

Please use Firefox 47.0.1, after install it, you could find it located in “C:\Program Files (x86)\Mozilla Firefox”, then test again.

>> The Edge driver continues to error with the message OpenQA.Selenium.WebDriverException: Cannot start the driver service on http://localhost:42623.

It seems that the latest driver might not work as it is targeted to Edge 16299 which comes with win 10 Creators Update. Please type winver in Run Command window, open About Windows, check the windows version in your environment. Then, download and use the corresponding MicrosoftWebDriver.exe.

Regards,

Judyzh

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].


Wednesday, January 31, 2018 5:54 PM

Thanks much for your reply. I had the same experience with my home machine with the firefox webdriver. Ended up removing the drivers, upgrading to Firefox 58.0.1 (32 bit) - reinstalled drivers and it now works.

Edge, on the other hand, with the following installed, I repeatedly get the error Message: OpenQA.Selenium.WebDriverException : Unexpected error. Unknown error. Any insight?


Thursday, February 1, 2018 2:33 AM

Hi absinc,

>> Edge, on the other hand, with the following installed, I repeatedly get the error Message: OpenQA.Selenium.WebDriverException : Unexpected error. Unknown error. Any insight?

Please try to add MicrosoftWebDriver.exe path in code, test again:

IWebDriver edgeDriver = new EdgeDriver("C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\VSTT\\Cross Browser Selenium Components");

If the issue persists, please try to update MicrosoftWebDriver.exe to the low version, and test again.

In addition, there’s a similar issue in github, please have a look at it: https://github.com/seleniumhq/selenium/issues/1617

Regards,

Judyzh

MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].