Selenium WebDriver on IE11 always has “--port=” in URL

牧云@^-^@ 提交于 2021-01-28 01:50:58

问题


I am trying to run some automated tests on IE11 using Selenium Webdriver. Whenever I run my code the URL that IE tries to load is http://--port=38198/

I am trying to simply load Google and return the title, then I will move onto the actual automated testing I intend to do. Here is a sample of my code so far;

private WebDriver driver;
private String baseUrl;

@Before
public void setUp() throws Exception{
    System.setProperty("webdriver.ie.driver", "C:\\Program Files\\Internet Explorer\\iexplore.exe");
    DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
    cap.setCapability(CapabilityType.ForSeleniumServer.ENSURING_CLEAN_SESSION, true);
    baseUrl = "http//www.google.com";
    driver = new InternetExplorerDriver(cap);
    driver.manage().deleteAllCookies();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

@Test
public void test() throws Exception{
    driver.get(baseUrl);
    System.out.println(driver.getTitle());
    //driver.navigate().to(baseUrl);
}

Ever time I run my code it always opens the same URL - http://--port= From my code I can't see where I have gone wrong. I changed the security settings on IE to medium and disabled protected mode (I have tried it with protected mode turned on and still no luck). I have also downloaded and installed Microsofts IE11 web driver.

I am totally mystified by this, can someone give me any insight into this...


回答1:


It seems that you are using your native Windows IE? You have to download the IE WebDriver from https://code.google.com/p/selenium/wiki/InternetExplorerDriver and your webdriver.ie.driver property needs the path to the downloaded IEDriverServer.exe

Please try and report if that solves your problem. If not I will change my chrome WebDriver to the IE and try it myself :)



来源:https://stackoverflow.com/questions/31831750/selenium-webdriver-on-ie11-always-has-port-in-url

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