Search code examples
c#seleniuminternet-explorer-11selenium-iedriveriedriverserver

actions.MoveToElement() not working on ie 11


The same method used in the test automation project I wrote in c # does not work in internet explorer 11 even though the movement method I use is chrome, firefox and edge. It does not give any errors, but the next action is fail

log.Debug("fare " + by + " üzeriine dogru haraket ediyor, webelement label ");
IWebElement element = GetElement(by);
Actions Actions = new Actions(Driver);
WaitElementToClickable(Driver, by, 5);
Actions.MoveToElement(element);
Actions.Perform();
WaitElementToClickable(Driver, by, 5);

Solution

  • I spent a long time trying to get actions to work across all browsers, and for IE I found the following helped.

    Selenium webdriver v2.29.0 (https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG) added:

    IEDriver supports "requireWindowFocus" desired capability. When
    using this and native events, the IE driver will demand focus and
    user interactions will use SendInput() for simulating user
    interactions. Note that this will mean you MUST NOT use the
    machine running IE for anything else as the tests are running.
    

    When I set the IEDriver I use:

    InternetExplorerOptions options = new InternetExplorerOptions();
    options.requireWindowFocus();
    webDriver = new InternetExplorerDriver(options);
    

    And all my move to and click events work fine. I'm using IE11.125-11.309 and Selenium (java bindings) 3.7.1.