Selenium IDE中的比较值

问题描述 投票:0回答:1

我是自动化测试和Selenium IDE的新手。我有一个测试用例仅更新电子邮件,另一个测试用例检查另一页上更新的电子邮件是否相同,如果比较的电子邮件相同,则测试通过。到目前为止,我只找到了一个更新值的选项,并且想知道是否有任何选项可以在不同页面中比较更新后的值。任何建议都会有所帮助。只是为了澄清,

测试用例1(操作):1.在浏览器中打开人事部门页面2.转到用户个人资料并更新用户电子邮件

测试用例2(检查):1.在浏览器中打开员工部门页面2.转到用户个人资料,查看测试案例1的更新电子邮件是否显示相同。

因为每个部门使用的数据库不同,所以如果电子邮件相同,则测试将通过,如果Selenium IDE上的电子邮件不同,则测试将失败。

selenium testing automation ide selenium-ide
1个回答
0
投票
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
© www.soinside.com 2019 - 2024. All rights reserved.