Question

I had created a java application for selenium webdriver.

FirefoxDriver driverff= new FirefoxDriver();

used to create a new Firefox instance. This is working fine.

I want to create a java web application to do the same.

I have embeded the same code in the servlet class in the doget() method and it throws

java.lang.NoClassDefFoundError: org/openqa/selenium/firefox/FirefoxDriver

Can someone tell me how i can fix this?

From an end to end perspective, what oi want to achieve is that a web page (done using servlets) has some buttons which when clicked need to open a selenium web driver and run the selenium scripts. I am assuming the java application for web-driver can be called using servlet.

If there is some other alternative to achieve this, please do suggest.

Was it helpful?

Solution

The error message means that Java can't find the class in question. Make sure it's on the classpath of your web app.

That said, you may run into problems later: Linux web servers often don't have an attached display so no X server is running. That will make it hard to start a browser :-) If that's the case for you, look up Google for "selenium xvnc" or "selenium headless"

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top