我的堆栈跟踪:
[java] 23 May 11 15:21:08, ERROR Failed to start new browser session, shutdown browser and clear all session data
[java] java.lang.IllegalArgumentException: Resource not found: /core
[java] at org.openqa.selenium.server.browserlaunchers.ResourceExtractor.extractResourcePath(ResourceExtractor.java:39)
[java] at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(HTABrowserLauncher.java:88)
[java] at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launch(HTABrowserLauncher.java:63)
[java] at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launchRemoteSession(HTABrowserLauncher.java:166)
[java] at org.openqa.selenium.server.browserlaunchers.InternetExplorerLauncher.launchRemoteSession(InternetExplorerLauncher.java:77)
[java] at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(BrowserSessionFactory.java:372)
[java] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:124)
[java] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(BrowserSessionFactory.java:86)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceHandler.java:733)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java:399)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceHandler.java:370)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:129)
[java] at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1530)
[java] at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1482)
[java] at org.openqa.jetty.http.HttpServer.service(HttpServer.java:909)
[java] at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
[java] at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
[java] at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
[java] at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:245)
[java] at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
[java] at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
[java] 23 May 11 15:21:08, INFO Got result: Failed to start new browser session: Error while launching browser on session null
只有当我从java类运行selenium测试用例时才会出现此错误:
public static void main(String [] args){ org.junit.runner.JUnitCore.main( “com.selenium.test.TestSelenium”); }
从Ant脚本运行selenium时不会发生此错误,如下所示
答案 0 :(得分:0)
您没有使用Selenium v2.0的WebDriver的原因是什么?它将自动解决浏览器位置和依赖关系,无需手动启动RC。它需要重写测试,但非常值得!
答案 1 :(得分:0)
使用setBrowser(“* iexploreproxy”);
并尝试相同也可以在执行* iehta时多次删除javascript错误。
使用上述浏览器模式执行时,您应该从管理员登录运行。