zoukankan      html  css  js  c++  java
  • 【WebDriver实战问题】selenium调用IE11浏览器,报错“找不到元素”

    转自:https://www.cnblogs.com/conquerorren/p/12982045.html
    刚好遇见这个问题,感觉很奇怪。多方查找,找到这个,给自己做保留。

    IE11不支持Selenium 2.0,在什么情况下不支持呢?比如:通过WebDriver获取页面上的元素时,经常会捕获到这样的异常: OpenQA.Selenium.NoSuchWindowException: Unable to find element on closed window at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse) in c:ProjectswebdriverdotnetsrcwebdriverRemoteRemoteWebDriver.cs:line 1139 解决方法: 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_MACHINESOFTWAREMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE. (32bit Windows看这里。) For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControlFEATURE_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_MACHINESOFTWAREWow6432NodeMicrosoftInternet ExplorerMainFeatureControlFEATURE_BFCACHE 如果FeatureControl下没有FEATURE_BFCACHE,就以FEATURE_BFCACHE为名new一个key!并在其下创建一个DWORD,取名为:iexplore.exe,value为0。
    
    
    
    修改完你的注册表后,重启你的计算机。之后以管理员权限运行Visual Studio(或者eclipse),打开你的项目,运行,你会发现,问题解决了。(注意:如果不使用管理员身份运行将仍然报错。)
  • 相关阅读:
    基础知识漫谈(5):应用面向对象来分析“语言”
    【线段树】BZOJ2752: [HAOI2012]高速公路(road)
    【树状数组】BZOJ3132 上帝造题的七分钟
    【AC自动机】Lougu P3796
    【Splay】bzoj1500(听说此题多码上几遍就能不惧任何平衡树题)
    【fhq Treap】bzoj1500(听说此题多码上几遍就能不惧任何平衡树题)
    【可持久化线段树】POJ2104 查询区间第k小值
    【RMQ】洛谷P3379 RMQ求LCA
    【倍增】洛谷P3379 倍增求LCA
    【网络流】POJ1273 Drainage Ditches
  • 原文地址:https://www.cnblogs.com/zf-crazy/p/15320235.html
Copyright © 2011-2022 走看看