I try to click on <button>
element that is child of <div>
. The <div>
also contains <span>
element with certain text that I stored some steps before. I have lots of elements that have the structure below, but only one of them contains the exact text in the <span>
. Based on the text in this <span>
I want to click on the <button>
above.
The structure of the HTML:
<td>
<div>
<button> Click </button>
<span> From ORI-1730 </span>
</div>
</td>
I am selecting the span this way:
(css=span:contains("${SelectOrder}"))
where "SelectOrder" == From ORI-1730.
And tried to select the button with:
(css=span:contains("${SelectOrder}").prev())
without success.
I have found some themes, but was unable to make them work for me:
您可以使用XPath
而不是CSS
来选择所需的按钮,如下所示:
xpath=//div[span[contains(text(), "${SelectOrder}")]]/button
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.