处理跨度标签中的动态文本更改
问题描述:
我点击提交按钮后,我将得到以下两条消息之一:处理跨度标签中的动态文本更改
1)状态信息找到。 请验证订单PO001007,然后按下。
2)为了无理货推 - 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
它会使甚至失败的条件作为通过..任何人都可以如何处理跨度标签内动态文本更改
是低是成功和失败的情况我的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>
答
你必须使用此XPath
试试这个:
不成功订购使用
///button[@class='close']/following::span[contains(text(),'Invalid')]
为了成功订购使用这个
//button[@class='close']/following::span[contains(text(),'order no')]
+0
如果我得到失败的消息 - 这DIV将与下面的div来代替
Invalid states information found. Please verify the order PO001007 and then push.
所以这个xpath也在查找这个div –
joy
+0
所以在我的成功条件下,即使对于失败信息也是如此 – joy
+0
两个结果都在同一页 – iamsankalp89
要查找什么,请让我知道 – iamsankalp89
我想找到
好了吧,亲爱的:)任何 – iamsankalp89