Selenium3.0在火狐、IE11运行的注意事项
2016-12-08 16:58
281 查看
1、IE11报Unable to get browser的错误,官方解决方案:
Required Configuration
The IEDriverServer exectuable must be downloaded andplaced in your PATH.
On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone.
To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
Additionally, "Enhanced Protected Mode" must be disabled for IE 10 and higher. This option is found in the Advanced tab of the Internet Options dialog.
The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
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.
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_BFCACHEsubkey 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.exewith the value of 0.
2、在火狐浏览器中执行,需要下载最新版本火狐浏览器,并且下载geckodriver.exe,放入火狐安装目录,把目录加入path变量中即可。
第二种办法当然就是使用限制的selenium3.0的版本,由于不在默认支持火狐浏览器,且 Message: 'geckodriver' executable needs to be in PATH 这个错误大家应该
都不陌生了,问题如看到的一样,需要名为geckodriver.exe的一个火狐浏览器driver在path中,当然解决办法就是,下载一个geckodriver.exe并将存放的路径添加在path中,简单点就
直接放python的根目录下即可,下载地址 https://github.com/mozilla/geckodriver/releases,另外需要注意下,geckodriver分32及64位的版本,版本需与浏览器对应。当你看到如下报错时,Expected browser binary location, but unable to find binary in default location, no 'moz:firefoxOptions.binary' capability provided,
and no binary flag set on the command line, 说明你的火狐浏览器和driver版本没有对应上,需确保火狐及driver都是32位或64位的。
3、 顺便提一下,很多人现在使用的robotframework版本及ride版本都比较落后,先说明下robotframework版本最新为3.0,ride的版本为1.5.2.1.所以引起打不开浏览器如果
上面的已经做了,仍然打不开,框架升级,需要同步升级一下工具
pip install -U robotframework
pip install -U robotframework-ride
pip install -U robotframework-selenium2library
总结下,如果使用selenium2.x的版本,需火狐浏览器为47及以下的版本,如果使用selenium3.0,需确保下载有geckodriver且路径在path中。目前selenium3.0支持火狐45及以上的版本。目前最新的火狐浏览器为49。
相关文章推荐
- Selenium WebDriver 2.0 升级到3.0 需要注意的事项 (2)
- Selenium自动化测试用例设计注意事项
- 项目从Codeigniter 2.2升级至 Codeigniter 3.0的一些注意事项
- Android Studio 3.0及Gradle Plugin 3.0升级注意事项
- 在android运行脚本的注意事项
- 反击式破碎机安装和运行时应注意的事项
- IE和火狐中,实现Flash背景透明注意事项
- liunx运行项目注意事项
- 使用Xvfb实现无界面Selenium自动化测试注意事项
- python + selenium + chrome 在实现back,forward,refresh时的注意事项
- lucene3.0_IndexWriter基础使用及注意事项
- Java 命令行运行java程序,出现“找不到或无法加载主类 ”的注意事项
- java环境配置——java能运行 javac 不是内部命令和外部命令 注意事项!
- ★Java-----记事本编译、运行时注意事项
- 用命令行编译和运行java类的注意事项
- 安装Symantec Clinet Security 3.0的注意事项:
- [Selenium] 配置 Internet Explorer Driver 的注意事项
- ios后台长时间运行的选择策略及注意事项
- 20180127-DCGANdemo运行注意事项