Python-selenium:Protected Mode settings are not the same for all zones.
来源:互联网 发布:如何抓取淘宝视频 编辑:程序博客网 时间:2024/06/07 23:22
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">编码环境:</span>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"> gvim 7.4</span>
运行环境:
win7-32(en)powershell
Python 2.7.11
代码:
# -*-* coding: utf-8 -*-from selenium import webdriverfrom time import sleep# driver=webdriver.Chrome()# driver=webdriver.Firefox()def login163(): url = 'http://mail.163.com/' user = 'user' pwd = 'pwd' browser = webdriver.Ie() browser.get(url) sleep(20) frame = browser.find_element_by_id("x-URS-iframe") browser.switch_to_frame(frame) browser.find_element_by_name( "email" ).clear() browser.find_element_by_name( "email" ).send_keys( user ) browser.find_element_by_name( "password" ).send_keys( pwd ) browser.find_element_by_id( "dologin" ).click() browser.switch_to_default_content() return browser if __name__ == '__main__': browser = login163() sleep(30) browser.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.'
法一
修改浏览器安全设置:
正如上面提示信息所说,Internet/本地Internet/受信任的站定/受限制的站点中的启用保护模式全部去掉勾,或者全部勾上
方法二
在生成webdriver对象之前,修改浏览器配置信息,如下:
#coding=utf-8from selenium import webdriverfrom selenium.webdriver.common.desired_capabilities import DesiredCapabilitiesDesiredCapabilities.INTERNETEXPLORER['ignoreProtectedModeSettings'] = Truedr = webdriver.Ie()dr.get("http://www.baidu.com")...dr.quit()
0 0
- Python-selenium:Protected Mode settings are not the same for all zones.
- webdriver 实例 IE8报错:Unexpected error launching Internet Explorer. Protected Mode settings are not the
- Are All Home Security Cameras the Same?
- All packages are not available for download! The following packages are not available:
- all packages are not available for download...
- All packages are not available for download
- Gradle settings for this project are not configured yet
- just the same和all the same
- remove all the same elements
- "Warning: the CID values for both test machines are the same"
- Not All Carrots Are Orange
- It is not safe to rely on the system's timezone settings. You are *required*
- Error:Application and test application id cannot be the same: both are 'com.xxxxxxx' for debugAndroi
- [Android]Error:Application and test application id cannot be the same: both are '' for debugAndroid
- PL/SQL and Python scripts for the same function
- android:id and id are not same...
- ValueError: The indices for endog and exog are not aligned
- URAL1997-Those are not the droids you're looking for
- log4j使用配置教程
- Oracle序列
- 【长篇高能】ReactiveCocoa 和 MVVM 入门
- 关于php后台使用继承模板的理解
- 求割点和桥模版
- Python-selenium:Protected Mode settings are not the same for all zones.
- Android 6.0(api 23) SDK,不再提供org.apache.http.*(只保留几个类)
- win7上 python 安装 lxml
- bzoj 2120: 数颜色 带修改莫队算法
- PS制作文字扫描效果(仿旧效果)
- C++原码、反码、补码详解
- 最近遇到的一些问题总结
- 不管是Wifi 、还是 4G 下都可以获取公网IP地址
- linux系统644、755、777权限详解