python+selenuim自动化测试(三)鼠标的操作

实现思路:

    1.需要引入ActionChains类;2.然后定位相关的元素;3.在ActionChains()调用相关鼠标操作的方法。

主要的代码:

    driver.find_element_by_css_selector("#kw").send_keys("输入的内容")

    element=dirver.find_element_by_css_selector("#kw")

     #双击操作

    ActionChains(dirver).double_click(element).perform()

    #鼠标悬停

    ActionChains(drirver).move_to_element(element).perform()

 

posted on 2018-08-22 09:44  Up_Miss  阅读(598)  评论(0编辑  收藏  举报

导航