2017-09-27 101 views
0

我點擊提交按鈕後,我將得到以下兩條消息之一:處理跨度標籤中的動態文本更改

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> 
+0

要查找什麼,請讓我知道 – iamsankalp89

+0

我想找到

Tally push of order no - PO001008 successful
該元素中跨越文本會改變,每次 – joy

+0

好了吧,親愛的:)任何 – iamsankalp89

回答

0

你必須使用此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