Quantcast
Channel: Chrome won't quit after assertion error occurs - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Chrome won't quit after assertion error occurs

$
0
0

I'm trying to get the browser to close when the test fails via assertion.

It outputs the correct log info in the log, but the browser does not close.

java.lang.AssertionError: Error: Title is 'Jordan | TolaActivity', and should be Country Name | TolaActivity

at org.junit.Assert.fail(Assert.java:88)at org.junit.Assert.assertTrue(Assert.java:41)at Tola.Activity.tests.LoginPage.Login(LoginPage.java:61)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at 
    @Test    // Test Case # 1: User can login successfuly    //    public void Login() throws Exception {        // -- Setup        driver.get(constants.URL);        Assert.assertTrue("Error: Title is '"+ driver.getTitle() +"', and should be company name Sign-on", driver.getTitle().startsWith("company name"));        // -- Test        driver.findElement(By.id("login")).sendKeys("username");        driver.findElement(By.id("password")).sendKeys("password");        driver.findElement(By.xpath("//*[@id=\"loginbox\"]/center[2]/input")).click();        Assert.assertTrue("Error: Title is '"+ driver.getTitle() +"', and should be Country Name | TolaActivity", driver.getTitle().contains("asdasd"));        driver.quit();    }}

Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images