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

WebDriver driver = new FirefoxDriver();

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 Answers 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


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 and acknowledge you have read our privacy policy.

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