Selenium 验证始终在更改的元素编号
我如何编写Selenium IDE命令来验证当我通过电子邮件邀请更多人时,该数字是否增加 例如,总人数:30人 示例1:如果我邀请了一个人,我如何验证总人数是否为31人? 例2:如果我邀请了5个人,我如何验证总人数是否为35人 代码如下:Selenium 验证始终在更改的元素编号,selenium,selenium-ide,Selenium,Selenium Ide,我如何编写Selenium IDE命令来验证当我通过电子邮件邀请更多人时,该数字是否增加 例如,总人数:30人 示例1:如果我邀请了一个人,我如何验证总人数是否为31人? 例2:如果我邀请了5个人,我如何验证总人数是否为35人 代码如下: <div style="color:#777; font-size:1.3em; float:right; margin-top:5px;"> Total number of people: <span style="
<div style="color:#777; font-size:1.3em; float:right; margin-top:5px;">
Total number of people:
<span style="color:red;">30</span>
总人数:
30
我相信您必须:
<tr>
<td>store</td>
<td>5</td>
<td>people_invited</td>
</tr>
<tr>
<td>storeText</td>
<td>//div[contains(text(),'Total number of people')]</td>
<td>original_count_text</td>
</tr>
<tr>
<td>storeEval</td>
<td>parseInt(storedVars['original_count_text'].match(/\d+/))+parseInt(storedVars['people_invited'])</td>
<td>expected_count</td>
</tr>
<tr>
<td>echo</td>
<td>Go invite 5 people</td>
<td></td>
</tr>
<tr>
<td>storeText</td>
<td>//div[contains(text(),'Total number of people')]</td>
<td>new_count_text</td>
</tr>
<tr>
<td>storeEval</td>
<td>parseInt(storedVars['new_count_text'].match(/\d+/))</td>
<td>new_count</td>
</tr>
<tr>
<td>verifyExpression</td>
<td>${expected_count}</td>
<td>${new_count}</td>
</tr>
商店
5.
受邀人士
storeText
//div[包含(text(),“总人数”)]
原始\u计数\u文本
仓库
parseInt(storedVars['original\u count\u text'].match(/\d+/)+parseInt(storedVars['people\u invested']))
期望值
回声
去邀请5个人
storeText
//div[包含(text(),“总人数”)]
新的\u计数\u文本
仓库
parseInt(storedVars['new\u count\u text'].匹配(/\d+/)
新计数
验证表达式
${预期的\u计数}
${new_count}