我正在尝试在 IE 上运行我的测试。问题是在 Firefox 上它可以工作,但是当我尝试在 IE 上运行它时,它会打开浏览器,导航到我的网站,但在页面完成后加载以下错误返回:
com.thoughtworks.selenium.SeleniumException: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 302 milliseconds
Build info: version: '2.21.0', revision: '16552', time: '2012-04-11 19:08:45'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_25'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply(SeleneseCommand.java:42)
at org.openqa.selenium.internal.seleniumemulation.Timer.run(Timer.java:39)
at org.openqa.selenium.WebDriverCommandProcessor.execute(WebDriverCommandProcessor.java:145)
at org.openqa.selenium.WebDriverCommandProcessor.doCommand(WebDriverCommandProcessor.java:75)
at com.thoughtworks.selenium.DefaultSelenium.focus(DefaultSelenium.java:221)
at com.extjs.selenium.form.TextField.setValue(TextField.java:127)
我的代码:
public void setUp(String server, String browser) throws Exception {
WebDriver driver = getWebDriver(InputData.BROWSER);
selenium = new WebDriverBackedSelenium(driver, server);
}
public WebDriver getWebDriver(String browser) {
if (browser.equalsIgnoreCase("*firefox")) {
return new FirefoxDriver(firefoxProfile);
} else if (browser.equalsIgnoreCase("*iexplore")) {
return new InternetExplorerDriver();
} else if (browser.equalsIgnoreCase("*chrome")) {
return new ChromeDriver();
} else if (browser.equalsIgnoreCase("*htmlunit")) {
return new HtmlUnitDriver(true);
} else {
logger.error("Browser not supported");
return null;
}
}
谁能帮我解决这个问题?我一直试图让它在 IE 上运行。我正在使用可以从 http://code.google.com/p/selenium/downloads/list下载的最新驱动程序
谢谢