Xpath to define checked flag in Selenium IDE

How to determine if a check is checked or not via xpath

I am currently trying:

//input[@type='checkbox' and @checked='true')]

I have several checkboxes with the same identifiers, so I have to select the next checkbox that is not selected / not set.

In particular, I need this for the Selenium IDE

Edit what I really need is:

|storeXpathCount | //input[@name='xyz' and @checked='checked'] | is_checked | 

if "xyz" is checked, the value of is_checked should be 1 else 0

thank

+5
source share
5 answers

enter image description here

stnewrecord - . Script , . , , , , .

xpath=(//input[@class='stnewrecord'])[${i}]  

xpath . "i" - , .

, .

+3

xpath

// Xpath, only works in certain situations
//input[@type='checkbox' and @checked='xyz']

, HTML-

checked="xyz"

"xyz" : "true", "checked", "ischecked",...

, , xpath .

, CSS, :

// CSS selector, for all checkboxes which are checked
input:checked[type='checkbox']

// CSS selector, for all checkboxes which are not checked
input:not(:checked)[type='checkbox']

,

[type='checkbox']

: -)

+8

CSS.

//input[@type='checkbox' and @checked]

//input[@type='checkbox' and not(@checked)]

//input[@type='checkbox' and @checked='xyz']
+2
source

something like this might work:

//input[@checked='checked']/following-sibling::*[1][not(@checked='checked')]
0
source

You can try the following:

//*[@type='radio'][@checked='checked']/
//*[@type='radio'][not(@checked='checked')]/
0
source

All Articles