I need to close all open Chrome drivers in Selenium. All my methods are closing only one of them. The reason why I need to close all drivers at the same time - in the start of my program I don't know how many drivers I need to open, so I try to open a few drivers with same driver names in cycle.
How I opened these drivers:
WebDriver driver = new ChromeDriver();driver.get(firstURL);driver = new ChromeDriver();driver.get(secondURL);
How I tried to close both drivers:
First try:
driver.close();
Second try:
driver.quit();
Third try:
driver.close();driver.close();
Fourth try:
driver.quit();driver.quit();