美文网首页
selenium之定位复选框(checkbox)

selenium之定位复选框(checkbox)

作者: test小星星 | 来源:发表于2018-09-26 15:42 被阅读36次

复选框如图


复选框
# 选择所有的checkbox并全部勾上  
checkboxes = driver.find_elements_by_css_selector('input[type=checkbox]')  
for checkbox in checkboxes:  
  checkbox.click()  
# 把页面上最后1个checkbox的勾给去掉  
driver.find_elements_by_css_selector('input[type=checkbox]').pop().click()  
#pop(1) 把第一个checkbox去掉

相关文章

网友评论

      本文标题:selenium之定位复选框(checkbox)

      本文链接:https://www.haomeiwen.com/subject/nizdoftx.html