<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>
尝试获取元素
elem = driver.find_element_by_xpath("//img[@src='images/icons/password_copy.gif']")
Or elem = driver.find_element_by_xpath("//img[@title='Copy password']")
Elem.click()
-不起作用
但无法单击该元素。出现错误:
raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotInteractableException: Message: Element is not displayed.
有人可以帮我解决该问题吗
答案 0 :(得分:0)
一种解决方法是使用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文档的更多信息。