我使用Selenium Webdriver進行一些機器人測試。由於某些功能似乎只能在Firefox中使用,因此我有義務使用Firefoxdriver。 偶爾會發生奇怪的事情。啓動te驅動程序FirefoxDriver上的打開網址因WebDriverException而失敗:無法解析「」
driver = new FirefoxDriver();
driver.get(URL);
獲取Firefox啓動但不去指定的URL。奇怪的是,它可以在Firefox中使用相同首選項的另一臺計算機上運行。我通過更改爲另一個版本的Firefox來解決了這個問題,但這一次對我來說並沒有什麼竅門,但它對其他開發者來說確實有效。是的,所有開發人員在同一天,同一天開始的錯誤... 我的第一個問題是:它是一個Firefox或Webdriver問題。第二個問題:它怎麼可能在其他PC上運行?
任何幫助將是非常讚賞 感謝
Error:
org.openqa.selenium.WebDriverException: Could not parse "".
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_18'
Driver info: driver.version: firefox
at org.openqa.selenium.firefox.Response.<init>(Response.java:53)
at org.openqa.selenium.firefox.internal.AbstractExtensionConnection.nextResponse(AbstractExtensionConnection.java:258)
at org.openqa.selenium.firefox.internal.AbstractExtensionConnection.readLoop(AbstractExtensionConnection.java:220)
at org.openqa.selenium.firefox.internal.AbstractExtensionConnection.waitForResponseFor(AbstractExtensionConnection.java:213)
at org.openqa.selenium.firefox.internal.AbstractExtensionConnection.sendMessageAndWaitForResponse(AbstractExtensionConnection.java:162)
at org.openqa.selenium.firefox.FirefoxDriver.executeCommand(FirefoxDriver.java:329)
at org.openqa.selenium.firefox.FirefoxDriver.sendMessage(FirefoxDriver.java:312)
at org.openqa.selenium.firefox.FirefoxDriver.sendMessage(FirefoxDriver.java:308)
at org.openqa.selenium.firefox.FirefoxDriver.fixId(FirefoxDriver.java:350)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:130)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:109)
at be.....MMCRobotTest.login(MMCRobotTest.java:98)
at be.....MMCRobotTestAttribute.testNewAttribute(MMCRobotTestAttribute.java:12)
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 junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at character 0
at org.json.JSONTokener.syntaxError(JSONTokener.java:496)
at org.json.JSONObject.<init>(JSONObject.java:180)
at org.json.JSONObject.<init>(JSONObject.java:403)
at org.openqa.selenium.firefox.Response.<init>(Response.java:41)
... 30 more
你傳入了什麼URL? – 2011-08-27 12:04:29
我從來沒有使用Webdriver,但它看起來像其他人都有同樣的問題。查看[此Google小組討論](http://groups.google.com/group/webdriver/browse_thread/thread/e899abc18da1c708/e9919658b10a1c7a?#e9919658b10a1c7a)。 – 2010-03-26 14:54:54