自动化测试(1)selenium+python+chrome 连接测试

环境准备:

python版本:3.6.8

开发工具:pycharm

使用chrome和对应的webdriver

http://npm.taobao.org/mirrors/chromedriver/

如何安装chromedriver?

将chromedriver放在chrome目录下,并解压运行

配置环境变量

 测试chromedriver是否配置成功,输入chromedriver

python下载selenium,输入pip install selenium

测试selenium

from selenium import webdriver
driver = webdriver.Chrome()#chrome浏览器
driver.get('http://baidu.com/')#访问百度
print(driver.title)#打印标题
driver.quit()

 会自动打开谷歌浏览器

原文地址:https://www.cnblogs.com/wangxue1314/p/13337404.html