1.打不开IE浏览器,这个需要下载IEDriverServer,这个可以在官网https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/dev-guides/dn800898(v=vs.85)下载,但是需要翻墙。
百度云链接:https://pan.baidu.com/s/11LYX8g6o6t0lWcR1GgrZxw 密码:p2lq。下载后放到python目录下
2.在注册机加入一个变量
For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. (这段告诉你需要修改注册表。)
For 32-bit Windows installations, the key you must examine in the registry editor is HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. (32bit Windows看这里。)
For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.(64bit Windows看这里。)
翻译过来的意思即,修改你的注册表(Run->regedit->Enter),路径如下:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE
如果FeatureControl下没有FEATURE_BFCACHE,就以FEATURE_BFCACHE为名new一个key!并在其下创建一个DWORD,取名为:iexplore.exe,value为0。
这里我系统软件都是64位的,但是创建选的是32位。
3.打开IE11,打开internet选项,点击安全,保证Internet、本地Internet、受信任站点、受禁止站点下的“启动保护模式(要求重启internet explorer)”的勾选情况一致,这样就能够识别element了。