web前端自动化测试(selenium3 for python3)

2.5selenium中使用ActionChain悬停及拖拽实现

2020-03-21  本文已影响0人  测试星云
driver = webdriver.Chrome("/Users/lindafang/PycharmProjects/selenium3forpython2020/driver/chromedriver")
driver.get("http://jqueryui.com/resources/demos/sortable/connect-lists.html")
left2=driver.find_element_by_xpath("//*[@id='sortable1']/li[3]")
right2=driver.find_element_by_xpath("//*[@id='sortable2']/li[2]")

# ActionChains(driver).drag_and_drop(left2,right2).perform()
ActionChains(driver).click_and_hold(left2)\
    .move_to_element(right2)\
    .release(right2)\
    .perform()
上一篇下一篇

猜你喜欢

热点阅读