0
votes

I am new to Automation Testing and Selenium IDE. I have one testing case which update just the email and another testing case which check if the update email is the same on another page.Test passes if the compared email is the same. So far, I only found an option to update the values and wondering if there is any option to compare the updated values in different page. Any suggestion would be helpful. Just to clarify,

Test case 1(Action): 1. Open HR department page on browser 2. Go to user profile and update user email

Test case 2(Check): 1. Open Employee department page on browser 2. Go to user profile and see if the update email from test case 1 is showing the same.

Because we're using different database for each departments, the test will passed if the email is the same, and the test will failed if the email is not the same on Selenium IDE.

2

2 Answers

1
votes

For Selenium IDE 3.16.1:

   Command  |                Target               |    Value 
Test case 1:
open        | HR department page 
open        | user prfile
type        | user-email-locator1 (id=... css=...)| [email protected] 
store value | user-email-locator1 (id=... css=...)| var1

Test case 2:
open        | Employee department page 
open        | user prfile
store value | user-email-locator2 (id=... css=...)| var2
verify      | var2                                | ${var1}

Run both testcases (You must write Test case 1 first).
If var1 value equals var2 value, tests will completed successfully.

0
votes
Selenium inbuilt does not have a compare function.

In case of Java, you have to hold the user email of test case 1 in a variable 
In test case 2, capture the existing email displayed
then, compare both values using .equals ( Since email is String )

refer the same code below,
String testcase1_email=driver.findElement(By..).gettext();
String testcase2_email=driver.findElement(By..).gettext();
if(testcase1_email.equals(testcase2_email))
 System.out.println("Email id Matches")
else
  System.out.println("Email id does not Matches")

Hope this helps