2024-09-29 00:17:45 发布
网友
我想确定是否选中了我正在测试的网页的复选框。我使用的是Selenium&Python。在
网页Html片段:
<input class="ng-untouched ng-pristine ng-valid" _ngcontent-ddp-11="" name="printInput" type="checkbox"/>
当我试过的时候
它总是返回True。在
True
这里有人能帮助确定复选框的状态吗?在
您可以使用is_selected()方法:
is_selected()
如果复选框被选中,则返回booleanTrue,否则返回{}
boolean
还请注意,您试图将get_attribute()应用于list-它不能返回您True,而是返回{}
get_attribute()
list
您可以使用
^{1}$is_selected()
方法:如果复选框被选中,则返回}
boolean
True
,否则返回{还请注意,您试图将}
get_attribute()
应用于list
-它不能返回您True
,而是返回{相关问题 更多 >
编程相关推荐