Jacek
Jacek

Reputation: 12053

Firefox crash when I run selenium unit test

I start use Selenium.WebDriver (v2.45) to run visual tests.

As web driver I use FirefoxDriver. I have installed Firefox 38. When I try run test firefox return exception with message:

FF has stopped working.

Does anyone have any suggestions? It worked in previous week, is it possible that my test was crashed by updated?

Problem signature:
  Problem Event Name:   APPCRASH
  Application Name: Firefox.exe
  Application Version:  38.0.1.5611
  Application Timestamp:    55540a1a
  Fault Module Name:    xul.dll
  Fault Module Version: 38.0.1.5611
  Fault Module Timestamp:   55541969
  Exception Code:   c0000005
  Exception Offset: 0035669b
  OS Version:   6.3.9600.2.0.0.16.7
  Locale ID:    1033
  Additional Information 1: 5861
  Additional Information 2: 5861822e1919d7c014bbb064c64908b2
  Additional Information 3: a10f
  Additional Information 4: a10ff7d2bb2516fdc753f9c34fc3b069

There is my test method body:

[Fact]
public void ShouldLoginForTestAccount()
{
    var driver = new FirefoxDriver();
    driver.Manage().Cookies.DeleteAllCookies();
    driver.Navigate().GoToUrl(LoginPage);

    driver.FindElementById("Login")
        .SendKeys("correctLogin");
    driver.FindElementById("Password")
        .SendKeys("correctPassword");

    driver.FindElementByTagName("button")
        .Click();

    Assert.Equal(TestingProjectUrl, driver.Url);

    driver.Close();
}

Upvotes: 3

Views: 2385

Answers (2)

Bruno Leitão
Bruno Leitão

Reputation: 811

I have a suggestion. I was getting the error bellow when I called Quit() method of WebDriver.

unknown software exception (0x80000003) em 0x55fdec79

So I created the WebDriver as follow:

FirefoxOptions foxOptions = new FirefoxOptions();
foxOptions.SetPreference("dom.allow_scripts_to_close_windows", true);
driver = new ThreadLocal<IWebDriver>(() => { return new FirefoxDriver(service as FirefoxDriverService, foxOptions, new TimeSpan(0, 1, 0)); }).Value;

Then, before call Quit() method, I execute one javascript to close the main window:

try { ((IJavaScriptExecutor)driver).ExecuteScript("window.close();"); } catch { }

So now I'm able to call Quit() without get any error. I know that this is a workaround, but I think this can help you.

Upvotes: 0

alecxe
alecxe

Reputation: 473873

Selenium 2.45 does not reliably work with Firefox 38 due to compatibility issues.

Downgrade Firefox to 35 (link to 35.0.1).

Upvotes: 4

Related Questions