以下是html代码片段:
<div autoid="" buttondecorator="" class="ideas-card _ngcontent-zty-5 collapsed-card" aria-label="Find new keywords" aria-expanded="false" aria-describedby="F7C56A74-5C67-4B02-B3E2-AFD3DFBA318B--0" aria-hidden="false" id="F49F12F8-6C5C-4567-AAD9-6C76A52FD801--0" tabindex="0" role="button" aria-disabled="false"></div>
从上面的代码片段来看,它是一个card元素,我正在使用seleniumpython尝试单击该元素。你知道吗
我的代码是:
find_new = browser.find_element_by_xpath("//div[@aria-label='Find new keywords']").click()
有没有其他方法来选择那个元素?你知道吗
我收到的错误消息是:
element not interactable
(Session info: chrome=74.0.3729.169)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Windows NT 10.0.16299 x86_64)
您可能需要等待该元素成为可单击的,然后再单击它。使用WebDriverWait和预期条件:
您可以尝试的另一个技巧是使用JavaScript Executor:
相关问题 更多 >
编程相关推荐