问题描述
我正在尝试使用Selenium Webdriver在IE11上运行一些自动化测试.每当我运行代码时,IE尝试加载的URL就是 http://-port = 38198/
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/
我试图简单地加载Google并返回标题,然后我将继续进行打算进行的实际自动化测试.到目前为止,这是我的代码示例;
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);
}
每次我运行代码时,它总是打开相同的URL- http://-port =
从我的代码中,我看不到哪里出了问题.我将IE上的安全设置更改为中级,并禁用了保护模式(我尝试过在保护模式打开的情况下进行此操作,但仍然没有运气).我还下载并安装了Microsoft的IE11网络驱动程序.
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...
推荐答案
似乎您正在使用本地Windows IE?您必须从 https://code.google.com/p/selenium下载IE WebDriver./wiki/InternetExplorerDriver 和您的 webdriver.ie.driver
属性需要下载的 IEDriverServer.exe
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
请尝试报告是否可以解决您的问题.如果没有,我将自己的chrome WebDriver更改为IE,然后自己尝试:)
Please try and report if that solves your problem. If not I will change my chrome WebDriver to the IE and try it myself :)
这篇关于IE11上的Selenium WebDriver始终具有"--port ="在URL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!