Note that there are some explanatory texts on larger screens.

plurals
  1. POdriver.close not working in testng
    primarykey
    data
    text
    <p>Hi when i am running my test through a plan java code and use WebDriver's close() method it is closing respective browser instance. But when i am using the driver.close() in a testNG class inside any of the @After annotations like</p> <pre><code>@AfterClass public void logout() { driver.findElement(By.id(someSignOutId)).click(); driver.close(); } </code></pre> <p>then it is not closing the browser instance. Please try below 2 code snippets : TestNGSnippet : </p> <pre><code>package unitTest.myTest; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.annotations.Test; public class GoogleTestNGTest { @Test public void f() throws InterruptedException { WebDriver driver=new FirefoxDriver(); driver.get("http://www.google.com"); Thread.sleep(2000); driver.close(); } } </code></pre> <p>Plain Snippet:</p> <pre><code>package unitTest.myTest; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class GoogleTest { public static void main(String[] args) throws InterruptedException { WebDriver driver=new FirefoxDriver(); driver.get("http://www.google.com"); Thread.sleep(2000); driver.close(); } } </code></pre> <p>Is it a bug in testNG. NOTE: driver.quit() is working, but i cannot use it as when i am running my tests in parallel then it will close all my browser instances on which tests are still running. TIA! Selenium WebDriver version : 2.33 TestNG : 6.8.5 Firefox version : 22 Java : 1.7.0.40</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload