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

编程入门 行业动态 更新时间:2024-10-26 14:38:52

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/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。


更多推荐

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

本文发布于:2023-06-14 08:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1455024.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:火狐   注意事项

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!