【发布时间】:2019-07-31 17:06:07
【问题描述】:
我正在尝试使用 python3 在 Chrome 中通过 selenium 检查一个复选框。 这是 HTML 代码:
<header class="list-header">
<aside class="list-header-bulk-selection">
<input type="checkbox" class="sc-cSHVUG iAwiCZ">
::after
我正在尝试通过以下方式选中该框:
check_mark = driver.find_element_by_xpath("//input[@class='sc-cSHVUG iAwiCZ']")
check_mark.click()
我能够找到该位置,但不幸的是我收到以下错误消息:
ElementNotInteractableException: Message: element not interactable
(Session info: chrome=75.0.3770.142)
我想我必须访问::after 行,但我不知道该怎么做。
【问题讨论】:
-
你可以试试
find_element_by_css_selector("input.sc-cSHVUG.iAwiCZ::after")
标签: python-3.x selenium xpath css-selectors webdriverwait