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

click入参说明

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

element):
 
 :参数 元素:元素或坐标 :param element: The element or point to click.
  \
  :py:class:`selenium.webdriver.remote.webelement.WebElement` or :py:class:`Point`
   
 使用说明如下: Clicks on the given element or point. Common examples are::
   
 
 
  click(Point(200, 300))
 
 
 调用方法 element)

 

click案例分析

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

Helium文档3-WebUI自动化-click点击

 

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()

Helium文档3-WebUI自动化-click点击

 

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

Helium文档3-WebUI自动化-click点击

 

欢迎关注

Helium文档3-WebUI自动化-click点击


 
                    
            
                

相关文章:

  • 2022-12-23
  • 2021-12-15
  • 2021-10-04
  • 2021-05-26
  • 2021-09-14
  • 2021-12-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案