from helium import *
import time
driver=start_chrome('https://www.baidu.com')
write('一拳超人')
press(ENTER)
time.sleep(2)
click("图片")
img=driver.find_element_by_name("pn8")
click(img)
click("下载")

helium的说明文档

Welcome to Helium’s documentation! — helium 3.0.9-SNAPSHOT documentation

首先pip install helium

然后复制ChromeDriver

下载链接ChromeDriver - WebDriver for Chrome - Downloadshttps://chromedriver.chromium.org/downloads

javascript:void(0)

 将chromedriver.exe拷贝至

谷歌浏览器目录(如 C:\Program Files\Google\Chrome\Application)

以及python根目录(C:\Python27)。

将谷歌浏览器环境变量添加到path(C:\Users\HD003\AppData\Local\Google\Chrome\Application)。

将代码运行

python helium python helium click_Chrome

python helium python helium click_前端_02

python helium python helium click_python helium_03

进一步学习

python helium python helium click_chrome_04

 

打开网页,查找网页元素,位置

python helium python helium click_python helium_05

 

python helium python helium click_前端_06