Webdriver not finding elements in remote IE

假如想象 提交于 2019-12-07 08:34:17

问题


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:


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)




回答2:


This works for. On IE goto Internet Option -> Security -> Uncheck Enable Protected mode for all the tabs. And rerun your project



来源:https://stackoverflow.com/questions/6983184/webdriver-not-finding-elements-in-remote-ie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!