web自动化:IE11运行Python+selenium程序

from selenium import webdriver  # 运行此脚本前必须按要求修改注册表
'''
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_HTTP_USERNAME_PASSWORD_DISABLE]
"iexplore.exe"=dword:00000000
针对IE11,需要修改注册表。如果是32位的windows,key值为HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InternetExplorer\Main\FeatureControl\FEATURE_BFCACHE
,如果是64位的windows,key值为HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\InternetExplorer\Main\FeatureControl\FEATURE_BFCACHE
如果key值不存在,就添加。之后在key内部创建一个iexplorer.exe,DWORD类型,值为0'''

driver = webdriver.Ie()
driver.get("http://www.baidu.com")
#driver.get("http://admin:[email protected]/")
需要下载与Python版本对应的webdriver

猜你喜欢

转载自www.cnblogs.com/jieliu8080/p/10511395.html
今日推荐