zoukankan      html  css  js  c++  java
  • Helium文档3-WebUI自动化-click点击

    前言

    click点击方法在web UI自动化中使用频率非常高,此方法就是模拟鼠标左键单击动作

    click入参说明

    1.首先我们来分析一下click方法的代码

    click(element):
      """
     :参数 元素:元素或坐标 :param element: The element or point to click.
      :type element: str, unicode, :py:class:`HTMLElement`,
      :py:class:`selenium.webdriver.remote.webelement.WebElement` or :py:class:`Point`
       
     使用说明如下: Clicks on the given element or point. Common examples are::
       
      click("Sign in")
      click(Button("OK"))
      click(Point(200, 300))
      click(ComboBox("File type").top_left + (50, 0))
      """
     调用方法 _get_api_impl().click_impl(element)

     

    click案例分析

    1、点击文字,
    start_chrome("https://cn.bing.com/")
    highlight("地图") # 高亮展示
    time.sleep(5)
    click("地图")
    kill_browser()

    2、点击按钮,通过calss定位
    start_chrome("https://www.icourse163.org/")
    time.sleep(5)
    cell= S(".u-search-icon")
    highlight(cell)
    time.sleep(5)
    click(cell)
    time.sleep(5)
    kill_browser()

    3、点击按钮,通过id定位
    click(S('#dologin'))

     

    欢迎关注

    
    
  • 相关阅读:
    jq-demo-阻止冒泡,阻止默认行为
    jq-demo-轮播图
    jq-demo-点击选择(英雄联盟)
    jq-demo-tab切换
    jq-demo-拖拽
    hdu 4031 Attack 线段树
    codeforces 633C. Spy Syndrome 2 hash
    sublime模式下开启vim并修改esc
    codevs 1256 打鼹鼠 LIS
    codevs 1455 路径 计算m^n%p
  • 原文地址:https://www.cnblogs.com/weitung/p/13538992.html
Copyright © 2011-2022 走看看