3

On the login page that I am trying to automate, generates a pop-up for invalid login credentials. I am using a try, catch block to switch control to alert message and check whether the alert pops or not in order to decide between successful and unsuccessful login. Below is the function I am using for this purpose:

public alertChecker isAlertPresent(WebDriver driver)
    {
        alertChecker acObj = new alertChecker();
        try{            
            Alert alt = driver.switchTo().alert();
            acObj.sAlertMessage = alt.getText(); // get content of the Alter Message
            acObj.bAlertPresent = true;
            alt.accept();           
        }    
        catch (NoAlertPresentException Ex)
        {           
            acObj.bAlertPresent = false;
            acObj.sAlertMessage = "";
        }
        return acObj;
    }

I have 4 inputs, 1st has valid credentials and remaining are invalid. I am able to run the test for one valid followed by another 2 invalid combinations. While running the test for last set of credentials, I am getting below error:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status from unexpected alert open

I am using Chrome browser. Please help me resolve this

2
  • which version of Chrome are you using? Commented Jul 10, 2016 at 5:22
  • 2
    The issue is with the latest version of chromedriver.exe. I downgraded to version 2.18 and it was resolved Commented Jul 10, 2016 at 13:21

1 Answer 1

3

This isn't an answer, but it's too big for a comment. This is a bug in the latest chrome. I would suggest starring and commenting here: https://bugs.chromium.org/p/chromedriver/issues/detail?id=1362&can=2&start=0&num=100&q=&colspec=ID%20Status%20Pri%20Owner%20Summary&groupby=&sort=

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! The last comment, there, says this has been fixed as of version "2.23". Simply replacing the executable solved this problem for me sites.google.com/a/chromium.org/chromedriver/downloads
I saw it was in 2.21 and fixed by 2.24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.