Facing an error
org.openqa.selenium.NoSuchSessionException: invalid session id
when tried to execute below script in testng and all opened browsers are not closing
public class Sample {
WebDriver driver = null;
@BeforeMethod
public void setUp() {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
}
@Test(dataProvider = "dataProvider")
public void test(String url, String arg1, String arg2) throws InterruptedException {
driver.get(url);
System.out.println("driver.getTitle()" + driver.getTitle() + "arg1 :" + arg1 + "arg2 :" + arg2);
}
@AfterMethod
public void tearDown() {
driver.close();
driver.quit();
}
@DataProvider(parallel = true)
public String[][] dataProvider() {
return new String[][] { { "https://github.com/", "alex", "India" },
{ "https://jenkins.io/download/", "Krishna", "UK" },
{ "https://www.facebook.com/", "Bhupesh", "USA" } };
}
}
Its launching url perfectly but it is not closing the all the opened browsers please help