Reputation: 2589
I am trying to move the first steps in web scraping. I read about selenium and seems to me that it fit for what i am looking for. But i have some problems to start. I am following this tutorial selenium getting started and i am trying to compile the first example with my linux ubuntu. I have compiled in this way
javac -classpath selenium-server-standalone-2.20.0.jar Example.java
i have started selenium server with
java -jar selenium-server-standalone-2.20.0.jar
but i can't run Example. This way doesn't works
java Example
and this way too
java -classpath selenium-server-standalone-2.20.0.jar Example
I guess that the grammar is wrong, but where?
Upvotes: 0
Views: 412
Reputation: 3771
While writing code in Java a better approach would be using an IDE like Eclipse. Once you link the JARs and import them in your Java classes you can write your code quickly and efficiently.
On top of that, Eclipse has lot of plugins for testing software like Junit, TestNG's to help you create better test suites.
Not to mention a Java IDE is always helpful in debugging test code. Here is a tutorial on how to setup Eclipse with Selenium: link
Hope it helps.
Upvotes: 0
Reputation: 24447
You need to include the current directory in the classpath like so:
java -cp .:selenium-server-standalone-2.20.0.jar Example
Also since you did not actually put the Example.java
in org.openqa.selenium.example
, you probably want to delete the package org.openqa.selenium.example
in the first line of the source.
Upvotes: 1