0

I'm starting to build a set of simple automated tests. I have:

WebDriver driver = new FirefoxDriver();
driver.get("http://www.yahoo.com");

On the first line (where I instantiate the WebDriver), I am getting the following exception:

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function

What have I missed? I know what NoClassDefFoundError means - the class can't be found, but I'm not familiar with the class in question here. I have selenium-java-2.45.0 on my buildpath.

2

You also need selenium-server-standalone-version.jar, because the tests run against a Selenium server.

The test starts the server, then it starts the test, the server starts the browsers and the test communicates over the server to the browsers.

Duplicate of this SO question, this also contains possible other solutions, it describes possible other jars needed.

Instead I would use Maven as it downloads all depencies for you, see this blog post to get you started: http://www.wunderkraut.com/blog/creating-and-running-a-simple-selenium-webdriver-test/2011-09-15

0

you need to add the "selenium-server-standalone-version.jar" since your server runs against that. I guess you would have added "selenium-java-version.jar".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.