Selenium3.0在火狐、IE11运行的注意事项

1、IE11报Unable to get browser的错误,官方解决方案:

Required Configuration

  • The IEDriverServer exectuable must be downloaded and placed 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_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.

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。


  • 5
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值