导航

随笔分类 -  Helium

Helium 是一款 Web 端自动化开源框架,全称是: Selenium-Python-Helium , 从名字上 就可以看出, Helium 似乎和 Selenium 息息相关
摘要:前言 helium库是自带chromedriver的,我们怎么来查看在哪里呢? 目录介绍 用我的电脑上的路径打比方如下: D:\Program Files (x86)\Python38\Lib\site-packages\helium\_impl\webdrivers 如下图:会有3个文件夹,每个文 阅读全文

posted @ 2020-10-20 21:54 weitungblog 阅读(585) 评论(0) 推荐(0)

摘要:前言 hover 实现功能是将鼠标光标悬停在给定的元素或点上 入参介绍 element def hover(element): """ :param element: The element or point to hover. :type element: str, unicode, :py:cl 阅读全文

posted @ 2020-09-09 21:37 weitungblog 阅读(737) 评论(0) 推荐(1)

摘要:前言 前面说过helium是对Selenium 进行了封装,那么我们如何使用selenium的方法呢,通过下面的介绍,我们能够清楚在helium中能够使用selenium的任何方法 入参介绍 def get_driver(): """ Returns the Selenium WebDriver c 阅读全文

posted @ 2020-09-09 21:09 weitungblog 阅读(883) 评论(0) 推荐(0)

摘要:前言 go_to在当前的Web浏览器窗口中打开指定的URL 入参介绍 url def go_to(url): """ :param url: URL to open. :type url: str Opens the specified URL in the current web browser 阅读全文

posted @ 2020-09-02 22:05 weitungblog 阅读(513) 评论(0) 推荐(0)

摘要:前言 attach_file关键字根据官方介绍的作用是上传文件 入参介绍 def attach_file(file_path, to=None): """ :param file_path: The path of the file to be attached. :param to: The fi 阅读全文

posted @ 2020-09-02 07:07 weitungblog 阅读(853) 评论(0) 推荐(0)

摘要:前言 Text关键字的作用是识别网页上的文字,在一般UI查找中使用率非常高,但是需要注意,如果网页上有相同的文字,那么只能识别到第一个 入参介绍 以下是Text的源码 有5个如参:后面4个参数是上下左右的定位辅助,后面举例中详细介绍 text=None, below=None, to_right_o 阅读全文

posted @ 2020-08-29 21:29 weitungblog 阅读(1110) 评论(0) 推荐(0)

摘要:前言 find_all关键字根据官方介绍的作用是查找所有出现GUI元素,并且返回list,下面通过举例说明 入参介绍 def find_all(predicate): """ Lets you find all occurrences of the given GUI element predica 阅读全文

posted @ 2020-08-29 07:18 weitungblog 阅读(1512) 评论(0) 推荐(0)

摘要:前言 wait_until等待某个条件为真才继续往下执行。默认的超时时间为10s,每0.5查询一次,这俩参数选填。可以设置超时时间和轮询间隔。 可以作为添加后校验元素是否存在的场景 入参介绍 def wait_until(condition_fn, timeout_secs=10, interval 阅读全文

posted @ 2020-08-26 22:03 weitungblog 阅读(1300) 评论(0) 推荐(0)

摘要:前言 highlight方法是通过红框高亮显示元素,在调试中有很大优势,可以清楚看到定位的元素位置 入参介绍 def highlight(element): """ 入参:元素 :param element: The element to highlight. Highlights the give 阅读全文

posted @ 2020-08-25 22:19 weitungblog 阅读(526) 评论(0) 推荐(0)

摘要:前言 S方法可以灵活定位元素特别注意,比如to_left_of参数的使用是查找在某个元素左侧的元素,但是默认只会找第一个S方法可以灵活运用,特别是没有id,没有name,只有classname的情况,可以多次使用方向的判断,比如:<li class="nav_com_li "><a class="c 阅读全文

posted @ 2020-08-24 21:24 weitungblog 阅读(756) 评论(0) 推荐(0)

摘要:前言 press方法是用来模拟键盘按键输入,可以组合使用,来模拟键盘输入,解决一些难定位的元素 入参介绍 以下是press源码中的函数介绍 def press(key): :入参 :param key: Key or combination of keys to be pressed. Presse 阅读全文

posted @ 2020-08-23 19:32 weitungblog 阅读(852) 评论(0) 推荐(0)

摘要:前言 write方法是模拟在输入框中写入数据 write入参说明 def write(text, into=None): """ :param text: The text to be written. :type text: one of str, unicode :param into: The 阅读全文

posted @ 2020-08-22 21:33 weitungblog 阅读(1000) 评论(0) 推荐(0)

摘要:前言 click点击方法在web UI自动化中使用频率非常高,此方法就是模拟鼠标左键单击动作 click入参说明 1.首先我们来分析一下click方法的代码 click(element): """ :参数 元素:元素或坐标 :param element: The element or point t 阅读全文

posted @ 2020-08-21 21:45 weitungblog 阅读(1485) 评论(0) 推荐(0)

摘要:学习思路: 查看github项目的源码,每个方法都有介绍及使用说明 https://github.com/mherrmann/selenium-python-helium/blob/master/helium/__init__.py __all__ = [ # Actions: 方法 'attach 阅读全文

posted @ 2020-08-20 21:47 weitungblog 阅读(1716) 评论(0) 推荐(0)

摘要:前言 Helium 是一款 Web 端自动化开源框架,全称是:Selenium-Python-Helium,从名字上就可以看出,Helium 似乎和 Selenium 息息相关,基于Selenium的更轻量级的浏览器自动化。 确实,Helium 针对 Selenium 进行了封装,它屏蔽了 Sele 阅读全文

posted @ 2020-08-19 21:50 weitungblog 阅读(1148) 评论(0) 推荐(0)