Shilpa
Shilpa

Reputation: 85

How to close firefox browser in selenium 3.0.1

Firefox : 50.0.1, GeckoDriver :13, selenium 3.01, IDE: Eclipse, Programming language : Java

Using below code :

System.setProperty("webdriver.gecko.driver","C:\\geckodriver.exe); 
WebDriver driver = new FirefoxDriver();
driver.get("https://www.youtube.com/");
driver.close(); Or driver.quit()

In driver.close() the browser is not closed In driver.quite() the browser is closed and Firefox crashed. Getting Error: "plugin container for FireFox has stopped working."

Please let me know any solution

Upvotes: 1

Views: 11519

Answers (4)

RubenD
RubenD

Reputation: 21

This seems to be a problem with the geckodriver.

The workaround which worked for me was to install the older version of geckodriver, 0.20.1, which you can download here: https://github.com/mozilla/geckodriver/releases/tag/v0.20.1

Upvotes: 0

Anand
Anand

Reputation: 193

You can create a new firefox profile steps can be found here!

In your code use this new profile created.

WebDriver webdriver;
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("myProfileName");
webdriver = new FirefoxDriver(myprofile);

Now webdriver.quit(); will close the firefox browser after the test has run.

Upvotes: 0

acikojevic
acikojevic

Reputation: 945

You should always use driver.quit() when you want to close browser and not just one tab.

This exception you get is unfortunately known issue when quitting geckodriver firefox instance, see this links for details.

https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/7506 https://bugzilla.mozilla.org/show_bug.cgi?id=1027222

Upvotes: 1

Naveen Kumar R B
Naveen Kumar R B

Reputation: 6398

Steps you can try:

  1. Uninstall any plugins in the Firefox browser.
  2. Use the 64-bit version of geckodriver for 64-bit Firefox, similarly, 32-bit geckodriver for 32-bit Firefox.

I have tried the code in the same environment, and driver.quit worked for me. driver.close still not closing the browser.

Upvotes: 1

Related Questions