windows下pip升级到8.1.1 及安装Selenium

1.升级pip

windows CMD

D:\Program Files\Python34\Scripts>pip install --upgrade pip 升级失败,提示尝试替换自身失败
改用

D:\Program Files\Python34\Scripts>easy_install pip 升级到最新版本

Python环境

python -m pip install -U pip

2.安装Selenium

windows CMD

D:\Program Files\Python34\Scripts>pip install selenium

输出:

Requirement already satisfied (use --upgrade to upgrade): selenium in d:\program
files\python34\lib\site-packages

VS建立项目测试:

# -*- coding: utf_8 -*-

import os
from selenium import webdriver

iedriver = "C:\Program Files\Internet Explorer\IEDriverServer.exe"
os.environ["webdriver.ie.driver"] = iedriver

driver = webdriver.Ie(iedriver)
driver.get("http://www.baidu.com")
print(driver.title)
driver.quit()

运行提示:

selenium.common.exceptions.WebDriverException: Message: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones

修改注册表 HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones

修改1、2、3、4文件中2500属性值 修改成相同属性值、如1-2文件中是3,3-4文件中是0,修改3、4中2500属性值为3,重新运行脚本即可打开浏览器
参考http://www.cnblogs.com/cllovewxq/p/5420546.html

 

转载于:https://www.cnblogs.com/dennysong/p/5432483.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值