【发布时间】:2017-09-27 06:38:02
【问题描述】:
单击提交按钮后,我收到以下两条消息之一:
1) 发现的状态信息。请验证订单 PO001007 然后推送。
2) 订单号的 Tally 推送 - PO001008 成功
对于成功条件,我正在使用这个 xpath:
.//*[@id='wrap']/div[2]/div[2]/div/div[4]/span[text()='Tally push of order no - PO001008 successful']
但是里面的文字每次都在变化,所以如果我用这个xpath:
.//*[@id='wrap']/div[2]/div[2]/div/div[4]/span
即使失败的条件也会通过。有人知道如何处理 span 标签内的这种动态文本变化吗?
下面是我的成功和失败条件的html代码:
<div class="alert alert-info alert-dismissable">
<button class="close" type="button" data-dismiss="alert" aria-hidden="true">×</button>
<span>Invalid states information found. Please verify the order PO001007 and then push.</span>
</div>
-----------------------------------------
<div class="alert alert-info alert-dismissable">
<button class="close" type="button" data-dismiss="alert" aria-hidden="true">×</button>
<span>Tally push of order no - PO001008 successful</span>
</div>
【问题讨论】:
-
你想找到什么请告诉我
-
我想定位Tally push of order no - PO001008 成功这个元素在 span 中的文本每次都会改变
-
好的,:) 亲爱的
-
知道如何处理这个问题
-
我发布了一个 xpath 试试这个
标签: selenium xpath selenium-webdriver webdriver ui-automation