1 # -*- coding:utf-8 -*- 2 3 """ 4 在元素上执行双击操作 5 """ 6 7 from selenium import webdriver 8 from selenium.webdriver import ActionChains 9 10 driver = webdriver.Firefox()11 driver.get(r'F:\电子书\selenium\Selenium Testing Tools Cookbook(中文)\demo\DoubleClickDemo.html')12 13 message = driver.find_element_by_id('message')14 action_chains = ActionChains(driver)15 action_chains.double_click(message).perform() #鼠标双击动作