Webdriver not finding elements in remote IE

2019-05-04 02:37发布

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?

1条回答
甜甜的少女心
2楼-- · 2019-05-04 03:04

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)

查看更多
登录 后发表回答