I have a problem when I want to close all Firefox that is a running,I can close only one window. for example like this : I have a program where when I run firefox it will open and then end it will close firefox, but the problem is when my program is not running yet but there is already firefox running first and therefore I want to make before my program runs firefox I want to check whether there is a Firefox that is already open first, if there is then I have to close it, how do I do it?
and this is a little sample code
private static WebDriver driver;
private static WebDriverWait wait;
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.gecko.driver", DRIVER_LOCATION);
driver = new FirefoxDriver();
driver.manage().window().maximize();
wait = new WebDriverWait(driver, 30, 100);
runJourneys();
}
and this is the last process to close firefox
driver.quit();
my question is :
- How do I check is there firefox that has been running before ?
- How can I close all firefox window ?