Kevin
Kevin

Reputation: 587

Why selenium Firefox WebDriver cannot close browser after test

I am using FirefoxDriver on a portable version of Firefox although I have an installed version of Firefox on the same machine. In my test setUp(), I have:

System.setProperty("webdriver.firefox.bin", TestEnv.FirefoxBinPath);
driver = new FirefoxDriver();

Then the portable instance can be opened and the test runs successfully, but the browser doesn't close after the test even though in my tearDown() there is: driver.quit();

Can anyone explain why this could happen?

Many thanks!

Upvotes: 1

Views: 725

Answers (1)

djangofan
djangofan

Reputation: 29669

It must have something to do with the name of the firefox binary? Maybe WebDriver expects it to be "firefox.exe" and the .exe your running is different? Or it could be something else along those lines. Maybe the portable firefox doesn't connect to firefox system profiles the same? I think your on your own on this one. Why is it required that you use the portable one?

If you find no solution, you could always write your own process killer method:

Runtime.getRuntime().exec("pkill firefox");

Upvotes: 2

Related Questions