与selenium python绑定相关 - 鼠标悬停在行动
这是使用的代码 试图执行悬停操作,仍然无法正常工作
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
element_to_hover_over = driver.find_element_by_link_text("Documents")
hover = ActionChains(driver).move_to_element(element_to_hover_over)
hover.perform()
答案 0 :(得分:0)
这是一个例子:
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
browser = webdriver.Chrome()
browser.get('https://tomerlerner.com/')
action = ActionChains(browser)
x = action.move_to_element(browser.find_element_by_xpath('//*[@id="__next"]/section[2]/ul/li[1]/a'))
x.perform()