51Testing软件测试论坛

标题: selenium rc打开浏览器时出错,求指教 [打印本页]

作者: fireatice    时间: 2015-12-1 17:30
标题: selenium rc打开浏览器时出错,求指教
请教如下问题如何解决?求大神点化,谢谢。
代码如图code,如果是用firefox,报错信息如最下边,如果用chrome,则打开了浏览器如下,然后就执行不下去了,一直停在那个状态。


chrome的情况如图chrome:


firefox的报错信息:
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Error while launching browser
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:89)
    at autotest.Test02.setUp(Test02.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: com.thoughtworks.selenium.SeleniumException: Failed to start new browser session: Error while launching browser
    at com.thoughtworks.selenium.HttpCommandProcessor.throwAssertionFailureExceptionOrError(HttpCommandProcessor.java:97)
    at com.thoughtworks.selenium.HttpCommandProcessor.doCommand(HttpCommandProcessor.java:91)
    at com.thoughtworks.selenium.HttpCommandProcessor.getString(HttpCommandProcessor.java:262)
    at com.thoughtworks.selenium.HttpCommandProcessor.start(HttpCommandProcessor.java:223)
    at com.thoughtworks.selenium.DefaultSelenium.start(DefaultSelenium.java:81)
    ... 25 more




作者: joykao    时间: 2015-12-2 10:03
别用selenium1了嘛,用webdriver呀,论坛有最新的webdriver lib的,稳定性啥的都没得说,兼容到你最新的谷歌和火狐浏览器,同时推荐用testng替换junit
作者: @吕小布    时间: 2015-12-2 15:54
用WebDriver吧,建议不要用录制的代码,尽量自己去写
作者: @吕小布    时间: 2015-12-2 15:54
用WebDriver吧,建议不要用录制的代码,尽量自己去写




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2