Search code examples
internet-explorer-8seleniumwebdriverjbehave

Webdriver not finding elements in remote IE


I'm having a strange issue with webdriver. I have a local environment and a remote environment to perform my tests; they work great in Firefox in both environment, but with Internet Explorer 8, they only work in local.

Whenever I run the tests against the remote server it doesn't even find the textbox elements to make the login. I'm using a wait when finding elements, and I tried to increase the time until minutes, but nothing. I can see the element in IE browsing through the source code. I even compared the html generated from both of them and is the same.

I'm using selenium through JBehave (JBehave-web-selenium-3.3.4 with selenium-ie-driver-2.0b3)

To retrieve the element I'm using:

public WebElement getElementById(String elementId){
    return getMyWaiter()
    .waitForMe(By.id(elementId), TEST_DELAY_IN_S);
}

public WebElement waitForMe(By locator, int timeout) {
        WebDriverWait wait = new WebDriverWait(driver, timeout);
        return wait.until(Waiter.presenceOfElementLocated(locator));
}


public static Function<WebDriver, WebElement> presenceOfElementLocated(
            final By locator) {
        return new Function<WebDriver, WebElement>() {
            @Override
            public WebElement apply(WebDriver driver) {
                return driver.findElement(locator);
            }
        };
    }

Any idea why the different behaviour?


Solution

  • I found the issue, it's a security issue with Internet Explorer and remote servers. To fix it just add the remote server to the Trusted Sites (Tools > Options > Security Tab > Trusted Site)