html tool

2015年5月11日星期一

selenium 双击事件

问题:页面操作中有双击效果的要求
解决:
Java版 参考:http://www.ifree168.com/lib/?p=5034

import org.openqa.selenium.interactions.Actions; //双击事件使用 [popexizhi:add]

...
          //[popexizhi]相关内容为双击操作
          Actions action = new Actions(driver); 
          action.doubleClick().perform();// 鼠标在当前停留的位置做双击操作 
          action.doubleClick(driver.findElement(By.xpath(".//*[@id='96']/td[2]"))).perform();// 鼠标双击指定的元素

Python版 参考:http://www.cnblogs.com/fnng/p/3288444.html
from selenium.webdriver.common.action_chains import ActionChains
#定位到要双击的元素
qqq =driver.find_element_by_xpath("xxx")
#对定位到的元素执行鼠标双击操作
ActionChains(driver).double_click(qqq).perform()

没有评论:

发表评论