Xpath 确定复选框“已选中"Selenium IDE 中的属性 [英] Xpath to determine checkbox "checked" attribute in Selenium IDE
问题描述
如何通过xpath判断一个checkbox是否被选中
How to determine if a checkbox is check or not through xpath
目前我正在尝试:
//input[@type='checkbox' and @checked='true')]
我有多个具有相同 ID 的复选框,因此我必须选择下一个未选中/选中的复选框.
I have multiple checkboxes with same ids so I have to select the next checkbox which is not selected/checked.
特别是我需要这个用于 Selenium IDE
Specifically I need this for Selenium IDE
编辑我真正需要的是什么:
|storeXpathCount | //input[@name='xyz' and @checked='checked'] | is_checked |
如果复选框 'xyz' 被选中,is_checked 值应该是 1 否则 0
if checkbox 'xyz' is checked , is_checked value should be 1 else 0
谢谢
推荐答案
这里 stnewrecord
是复选框类.脚本将存储复选框的数量,并根据该循环将遵循.它会检查复选框是否被选中,如果没有它会检查否则移动到下一步.
Here stnewrecord
is class of check-box.
Script will store number of check-box, and according to that loop will follow.
It will check whether check-box is checked or not if not it will check else move to next step.
xpath=(//input[@class='stnewrecord'])[${i}]
这是复选框的xpath.'i' 是位置,每次迭代都会增加.
This is xpath of check-box. 'i' is position, it will increase on each iteration.
让我知道它是否适合您..
Let me know whether its working for you or not..
这篇关于Xpath 确定复选框“已选中"Selenium IDE 中的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!