0

In selenium if zoom level is set to 75% using desired capabilities for IE browser, Click() of elements not happening. But internally in code, it says element clicked. but in UI, click doesn't really happened. Any idea how to fix this

Sundar
  • 11
  • 3

1 Answers1

0

OK , Im not sure why you want to use 75% zoom , This is an issue even when you use UFT as an automation tool. Two things that you might want to try . You haven't posted you desired capabilities code . So please try to add this capabilities to your existing one

                capabilities.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
            capabilities.setCapability(InternetExplorerDriver.ENABLE_PERSISTENT_HOVERING, false);
            capabilities.setCapability(InternetExplorerDriver.REQUIRE_WINDOW_FOCUS, true);
            capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
            capabilities.setCapability(InternetExplorerDriver.IGNORE_ZOOM_SETTING, true);
            capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,

If you want to to have a workaround , you might need to zoom back to default zoom (100%) click on the object and then zoom back to your desired zoom Try this code to zoom to default

/**
 * @author mbn
 * @Date 04/03/2018
 * @Purpose This method will perform a zoom to the default value
 * @param N/A
 * @return N/A
 */
public static void zoomToDefault() {
    driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, "0"));

}

Do the click on the element and then zoom back to 75% using this method

/**
 * @author mbn
 * @Date 05/03/2018
 * @Purpose This method will perform a zoom out n number of times
 * @param toExtent
 *            --> the number of times we want to zoom out
 * @return N/A
 */
public static void zoomOut(int toExtent) {
    log.info("Performing a zoom out");
    for (int i = 0; i < toExtent; i++) {
        driver.findElement(By.tagName("html")).sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT));
    }
}
mbn217
  • 884
  • 7
  • 14
  • 1
    you realize that you have specified several unrecommended and even contradictory capabilities in your suggested set of capabilities to add, right? – JimEvans May 24 '18 at 03:25
  • First approach doesn't works and i cannot zoom in and zoom out for all the click operations. – Sundar May 24 '18 at 10:56