selenium.common.异常.ElementNotInteractiableException:消息:未显示元素

2024-09-30 20:28:50 发布

您现在位置:Python中文网/ 问答频道 /正文

<DIV class="x-grid3-cell-inner x-grid3-col-column16" style="CURSOR: pointer" unselectable="on">IMG title="Copy password" style="FLOAT: left; MARGIN: 0px 3px 0px 0px; DISPLAY: block" src="images/icons/password_copy.gif" border=0></DIV>

试图通过

^{pr2}$

Elem.click()-不工作 但无法单击元素。获取错误:

raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: Element is not displayed.

有人能帮我找到解决办法吗


Tags: divimgtitlestyleoncellcolpassword
1条回答
网友
1楼 · 发布于 2024-09-30 20:28:50

解决这个问题的方法是使用Selenium中提供的ActionChains

from selenium.webdriver.common.action_chains import ActionChains
elem = driver.find_element #complete xpath
action = ActionChains(driver)
action.move_to_element_with #complete where you want to move element
action.click()
action.perform()

您可以阅读有关XPath ActionChains文档的更多信息。在

相关问题 更多 >