Select an item on the same line as a specific text

I am using Selenium IDE 1.7.1 to check the box corresponding to account # 405357. Css seems to allow me to move forward when I select an item, but not backward. So choose $ 420:

css=td:contains('405357') + td 

Any ideas on a workaround for selecting a checkbox? Ideally, the workaround would not include going back or forward, but just say select

 css=input#paymentsForm_invoiceToPayIds if td:contains('405357') 

I would prefer it to be in CSS, but XPath will be fine too.

Thanks!

enter image description here

 <table> <tbody> <tr> <td> <input id="paymentsForm_invoiceToPayIds" type="checkbox" onclick="calculateInvoices(this)" value="405357" name="invoiceToPayIds"> <input id="__checkbox_paymentsForm_invoiceToPayIds" type="hidden" value="405357" name="__checkbox_invoiceToPayIds"> </td> <td>405357</td> </tr> </tbody> </table> 
+4
source share
3 answers

I believe that :contains() works for the parent tr . Try the following:

 css=tr:contains('405357') input[type="checkbox"] 
+5
source

You cannot do this in real CSS because real CSS does not :contains . But in XPath, it’s simple: //tr[//input[@value="405357"]]//input[@type="checkbox"] , which means "A flag contained in a table row that contains an input field with a value "405357".

+2
source
 //input[@type='checkbox' and @value="405357"] 

try this one

0
source

Source: https://habr.com/ru/post/1401940/


All Articles