Unable to find element on closed window on IE 11 with Selenium

后端 未结 6 1685
醉话见心
醉话见心 2020-12-14 10:39

I\'m trying to run tests on Internet Explorer 11 working with Selenium WebDriver. The code is:

System.setProperty(\"webdriver.ie.driver\", \"Path/to//IEDrive         


        
相关标签:
6条回答
  • 2020-12-14 10:52

    Try going to Internet Options --> Security --> "Enable Protected Mode" on ALL zones should either be checked or ALL unchecked.

    0 讨论(0)
  • For 32-bit Windows: 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: 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.

    0 讨论(0)
  • 2020-12-14 11:05

    There are 2 ways:

    Way 1: Setting INITIAL_BROWSER_URL:

    File ieFile = new File("D:\\IEDriverServer_x64_2.53.0\\IEDriverServer.exe");
    System.setProperty("webdriver.ie.driver", ieFile.getAbsolutePath());
    DesiredCapabilities ieCaps = DesiredCapabilities.internetExplorer();
    ieCaps.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, "http://www.bing.com/");
    driver = new InternetExplorerDriver(ieCaps);
    //some operations on that site
    driver.findElement(By.id("sb_form_q")).clear();
    driver.findElement(By.id("sb_form_q")).sendKeys("Ripon Al Wasim");
    driver.findElement(By.id("sb_form_go")).click();
    

    Way 2: To set a registry entry on the target computer:
    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: 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: 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.

    For more details you can visit: https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration

    0 讨论(0)
  • 2020-12-14 11:08

    Ripon Al Wasim posted this url, which is a key to IE11 working with Selenium. https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver#required-configuration

    I had this setup:

    • Windows 7 Pro 64 bit
    • IE11 64 bit, latest I found
    • Selenium remote server 2.53.1 64 bit
    • IEDriverServer 2.53.1 64 bit
    • selenium 2.53.1 module installed on 64 bit linux machine used with 64 bit python

    downloaded from here: http://selenium-release.storage.googleapis.com/index.html?path=2.53/

    I had to follow the guide and to:

    • Set Enhanced Protected Mode to disabled in all security zones which is a requirement for IE10 and IE11.
    • Add the FEATURE_BFCACHE key and it's iexplore.exe DWORD into registry
    • I made all used software to be 64 bit.
    • Check that zoom in IE is set to 100%.
    • Check if size of text is 100% in Windows display settings.

    Additionaly:

    • I had to disable proxy settings in IE, because it prevented Selenium remote server to communicate with IEDriverServer.
    • I am running webdriver with requireWindowFocus set to true, because key typing with 64 bit selenium was slow due some timeout issue (Selenium WebDriver typing very slow in text field on IE browser)

    And it worked. I divert from the guide when I specify a path to IEDriverServer.exe when I run standalone server, so it doesn't necessary have to be in the PATH.

    0 讨论(0)
  • 2020-12-14 11:14

    I faced the same issue after going through every possible solution finally I got the answer.Try this it will definitely solve your problem as well.

    DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
    
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "IE");
    
    capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
    
    capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
    
    System.setProperty("webdriver.ie.driver","C://MavenTest//driver//IEDriverServer.exe");
    
    driver = new InternetExplorerDriver();
    
    0 讨论(0)
  • 2020-12-14 11:14

    I had faced the similar issue. I faced while I was running my code in the Maven build. Here in the POM XML file, I had a different version whereas actual selenium installed is another version. So just changed the version so that it matches with the installed version. And Now everything working fine

    0 讨论(0)
提交回复
热议问题