Samareri
Samareri

Reputation: 11

Opening URL on FirefoxDriver fails with WebDriverException: Could not parse ""

I'm using Selenium Webdriver to do some robottesting. Since some functions appear to only work in Firefox, I'm obligated to use Firefoxdriver. Now and then, something weird happens. Starting up te driver

driver = new FirefoxDriver();
driver.get(URL);

gets firefox to startup but not to go to the specified url. The strange thing is that it works on another computer with the same preferences set in Firefox. I solved this problem once by changing to another version of firefox, but this time this doesn't do the trick for me, it did however worked for the other developers. Yes, the error started for all developers on the same time, same day... My first question is: is it a firefox problem or Webdriver problem. Second question: how is it possible that it works on other pc's?

Any help would be very appreciated Thanks

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

Upvotes: 1

Views: 6984

Answers (3)

Raghu
Raghu

Reputation: 11

Make sure that the url is prefixed with the proper protocol like 'http://'. Removing this gave that exception and adding this prevented it.

Upvotes: 1

Amit Horakeri
Amit Horakeri

Reputation: 745

I think you've installed multiple versions of Firefox browsers, try uninstalling all and install the latest version... Hope this helps..

Upvotes: 0

Paresh
Paresh

Reputation: 1158

I suggest you to use latest version of Firefox browser with latest selenium server libraries. Or I think you forgot to include all lib jars on one machine where you are getting problem.

Upvotes: 1

Related Questions