NoSuchElementException is occurred during implementation of InternetExplorerDriver in Selenium WebDriver

后端 未结 3 1723
慢半拍i
慢半拍i 2020-12-03 05:45

Currently, I am working on WebDriver to invoke IE browser to run the testing. But I received a NoSuchElementException when I tried to run the simple example bel

相关标签:
3条回答
  • 2020-12-03 05:59

    You've explicitly avoided having to set the Protected Mode settings of IE. That's what the InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS capability setting does. When you remove this capability setting and set the Protected Mode settings as documented in the project wiki, it seems the problem resolves itself.

    0 讨论(0)
  • 2020-12-03 05:59

    There was a short FAQ entry on the project website (copied circa Selenium 2.9):

    The InternetExplorerDriver requires that all security domains are set to the same value (either trusted or untrusted) If you're not in a position to modify the security domains, then you can override the check like this:

    DesiredCapabilities capabilities =
    DesiredCapabilities.internetExplorer();
    capabilities.set(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
    true); 
    WebDriver driver = new InternetExplorerDriver(capabilities);
    

    As can be told by the name of the constant, this may introduce flakiness in your tests. If all sites are in the same protection domain, you should be okay.

    The parallel C# InvalidOperationException message:

    Unexpected error launching Internet Explorer. Protected Mode must be set to the same value (enabled or disabled) for all zones. (NoSuchDriver)

    and the C# instead of adjusting IE settings (best guess as of Feb 2016):

    var ieOptions = new OpenQA.Selenium.IE.InternetExplorerOptions {
                    IntroduceInstabilityByIgnoringProtectedModeSettings = true };
    using (var driver = new InternetExplorerDriver(ieOptions))
    {
    

    This was all part of issue 1795 on the Selenium issue tracker.

    0 讨论(0)
  • 2020-12-03 06:16

    Try adding implicitly wait like below. Also as Robert said, your URL should have http://

    WebDriver driver = new InternetExplorerDriver(ieCapabilities);
    driver.manage().timeouts().implicitlyWait(90, TimeUnit.SECONDS);
    
    0 讨论(0)
提交回复
热议问题