Helium初体验

测试代码

from helium import *

home_url = r'https://www.163.com/'
driver = start_chrome(home_url)
wait_until(Text("网易").exists)

username = r'18601936599@163.com'
password = r'Zhaobowen520'
hover(r'登录')

write(username,TextField('网易邮箱/常用邮箱'))
write(password,TextField('请输入密码'))
press(ENTER)

# hover(r'js_N_navUsername')
click(r'我的邮箱')
switch_to(Window("网易邮箱6.0版"))
press(LEFT_CONTROL + F4) 
switch_to(Window("网易"))

# wait_until(Text('收 信').exists)
# kill_browser()

代码还有一个问题就是窗口的关闭,查找代码没有找到window下有类似的方法。然后尝试用ctrl + f4关闭窗口,也没有执行。有空再尝试一下。

参考文档:

https://blog.csdn.net/ttphoon/article/details/107957775
https://github.com/mherrmann/selenium-python-helium/blob/master/helium/init.py

posted @ 2020-12-20 19:09  名字很长容易被惦记  阅读(210)  评论(0编辑  收藏  举报