我试图通过我的python代码检查多个复选框:
checkboxes=driver.find_elements_by_xpath("//input[@type='checkbox']")
for i in range(0,len(checkboxes)):
if checkboxes[i].is_selected():
time.sleep(2)
else:
checkboxes[i].click()
它可以在第一个复选框中正常工作,但在其余部分失败时会出现以下错误:
Element <input _ngcontent-rnm-59="" type="checkbox" class="ng-untouched
ng-pristine ng-valid"> is not clickable at point (584, 215).
Dropbox的HTML代码如下:
<div class="ps-content">
<div _ngcontent-rnm-59="" style="width: 300px;" class="scroll-300">
<!--template bindings={}--><div _ngcontent-rnm-59="">
<!--template bindings={}--><div _ngcontent-rnm-59="">
<label _ngcontent-rnm-59="" style="width: 100%; background-color: #d6d4d4">
LTE BASIC - Serving Cell
</label>
<!--template bindings={}--><li _ngcontent-rnm-59="" style="margin-right:-20 px">
<div _ngcontent-rnm-59="" class="checkbox-new" style="display:flex; width:100%; justify-content: space-between;">
<label _ngcontent-rnm-59="" style="width: 100%">
<input _ngcontent-rnm-59="" type="checkbox" class="ng-valid ng-dirty ng-touched"><span _ngcontent-rnm-59="" class="checkbox-material"></span> Voice RAT
</label>
请建议调试方式。