How to close firefox browser in selenium 3.0.1

Shilpa picture Shilpa · Jan 10, 2017 · Viewed 8.7k times · Source

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

Answer

Naveen Kumar R B picture Naveen Kumar R B · Jan 10, 2017

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.