导航

Helium文档14-WebUI自动化-hover鼠标悬浮

Posted on 2020-09-09 21:37  weitungblog  阅读(663)  评论(0编辑  收藏  举报

前言

hover 实现功能是将鼠标光标悬停在给定的元素或点上

入参介绍

element
def hover(element):
    """
    :param element: The element or point to hover.
    :type element: str, unicode, :py:class:`HTMLElement`, \
:py:class:`selenium.webdriver.remote.webelement.WebElement` or :py:class:`Point`

    Hovers the mouse cursor over the given element or point. For example::

        hover("File size")
        hover(Button("OK"))
        hover(Link("Download"))
        hover(Point(200, 300))
        hover(ComboBox("File type").top_left + (50, 0))
    """

 

举例说明

from helium import *
import time
start_chrome("https://cn.bing.com/")
driver = get_driver()
driver.maximize_window()  # 窗口最大化
hover(S("#shBingAppQR"))  # 悬浮
highlight(S("#shBingAppQR"))
time.sleep(5)
kill_browser()

 

欢迎关注