定位hover事件,和对应click标签
下面是代码触发
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import * # 动作 caipiaogames = handle.find_element_by_xpath('//*[@id="li_lotto"]') actions = ActionChains(handle) actions.move_to_element(caipiaogames) actions.perform() caipiaogames = handle.find_element_by_xpath('//*[@id="li_lotto"]/ul/li[3]/a') actions = ActionChains(handle) actions.move_to_element(caipiaogames).key_down(Keys.CONTROL).click(caipiaogames).key_up(Keys.CONTROL).perform()