Selenium+python环境搭建

1.Windows64+pythoy3.6+selenium2.53.6+Firefox46(建议不要安装在C盘)
2.python官网下载地址:https://www.python.org
3.Pip install selenium2.53.6安装selenium,若出现timrout(代理问题),请输入“pip install --index-url https://pypi.douban.com/simple selenium2.53.6”
Selenium+python环境搭建
查看Python安装路径:where python
查看selenium安装目录:pip show selenium
4.pycharm安装后,修改电脑本地日期为20年后,然后打开选择试用30天,再将日期修改回去
4.想正常启用chrome浏览器,需要在python的目录下放chromedriver.exe应用,且python已配置了环境变量
Selenium+python环境搭建
5.验证环境是否搭建成功:
启动浏览器代码如下
from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get(“https://www.baidu.com”)
Selenium+python环境搭建