当我尝试像这样实例化IEDriverServer 3.12.0时:
public string GetAppConfigPath()
{
var devenv = (DTE)_c.Site.GetService(typeof(DTE));
var projects = (Array)devenv.ActiveSolutionProjects;
var activeProject = (Project)projects.GetValue(0);
foreach (ProjectItem item in activeProject.ProjectItems)
{
if (!item.Name.Equals("app.config")) continue;
var info = new System.IO.FileInfo(activeProject.FullName);
if (info.Directory != null)
return info.Directory.FullName + "\\" + item.Name;
}
return null;
}
我看到了这个异常堆栈跟踪:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class StartInternetExplorer {
public static void main(String[] args) {
// Add to Windows PATH variable: C:\IEDriverServer_Win32_3.12.0\;
String executable = "C:\\IEDriverServer_Win32_3.12.0\\IEDriverServer.exe";
System.setProperty("webdriver.ie.driver", executable);
WebDriver driver = new InternetExplorerDriver();
driver.get("https://www.google.com");
driver.quit();
}
}
我不知道" ensureCleanSession"争论来自,所以我不知道这是否意味着3.12.0中存在错误,或者我是否未正确实例化IEDriverServer。
答案 0 :(得分:0)
尝试在URL中传递4个斜杠,并且可以正常工作。似乎他们在Selenium API中进行了一些更改,但我不确定。这对我有用:
import org.openqa.selenium.ie.InternetExplorerDriver;
public class Money {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Hello World");
System.setProperty("webdriver.ie.driver", "IEDriverServer.exe");
InternetExplorerDriver driver=new InternetExplorerDriver();
driver.get("https:\\\\www.google.com");
}
}
答案 1 :(得分:0)
我无法在3.14.0版中复制它-解决方案是等待新版本。
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class StartInternetExplorer {
public static void main(String[] args) {
// Add to Windows PATH variable: C:\IEDriverServer_Win32_3.14.0\;
String executable = "C:\\IEDriverServer_Win32_3.14.0\\IEDriverServer.exe";
System.setProperty("webdriver.ie.driver", executable);
WebDriver driver = new InternetExplorerDriver();
driver.get("https://www.google.com");
driver.quit();
}
}