How to Automate the Java script Alert box in Selenium.If we record for the first time ,the alert box says " user Id is available" but if we run the same script for the second time the alert box says "user Id already exists.please enter user name" .So Selenium cannot recognizes the pop up so how to handle this.
Maybe a regular expression for the text to recognize part of the line, or just look for a common item like User ID.
Nothing learns better than experience.
"So as I struggle with this issue I am confronted with the reality that noting is perfect."
Now wasting blog space at QAForums Blogs - The Lookout
Please give us more details what you want to achieve.
In most cases test should be designed in a way that initial conditions are always the same. So you maybe having 2 separated tests here.
In our application, we have check user button which is used to check the client .If Client does not exist, the alert message "Client ID Is Available" is dispalyed and if Client exist "ClientId already exist.please enter new clientID" is dispalyed.
While recording the script the following is captured ("assertEquals(selenium.getAlert(), "Client ID Is Available");"
Now when execute the script it stops when the alert message pops up.
The following script is recorded in selenium ide and running the script as TestNG in eclipse.
//Type the client name code generated is
//click on check user code generated is
// when we click on check user button, an alert message generated is like client id is available
assertEquals(selenium.getAlert(), "Client ID Is Available");
so how to handle this problem?
Did u fix that problem?? i am facing same now.. can u plz help me out..
Thanks in advance.