Google Groups

Re: [selenium-users] errors after install: Trying to run Selenium on Windows7 in java via Eclipse


Glenn Bagrowski Apr 5, 2012 8:43 AM
Posted in group: Selenium Users
Hey Mark,

Thanks again for your reply. I got into trying another testing software, but I'd still like to get Selenium running so that I can compare the products.

Anyway, I started the steps that you gave me in your last reply.. now I've downloaded IntelliJ IDEA and started following the directions on seleniums site for importing-maven-into-intellij-reference. Apparently, since this is the first time through, it's asking me what SDK to use. I'm selecting the IntelliJ SDK, but it's telling me that I require JSDK of 1_6.. I see on the jetbrains site that IntelliJ should be able to work with 1.6 or higher and I have 1.7 installed.. but it keeps giving me the error that I need 1.6 and won't let me progress further. Since you stated that you like the IntelliJ product, was hoping that you might be able to help me figure out what I need to do to get this working.

Thanks for your time,
Glenn

On Friday, March 30, 2012 5:34:06 PM UTC-4, Mark Collin wrote:

It sounds like you have got yourself a bit tangled up.

 

If you are using maven you do not need to download and extract anything, maven will deal with dependencies for you and download any packages required.  The important thing with maven is to ensure that your directory structure is correct as maven expects certain things in certain locations.  You can override the default directory locations, but I would advise strongly against it.  It makes your POM more complicated and anybody else used to maven who looks at your project will not find things in the location they are expecting to find things.

 

Have a look here for maven directory structure:

 

http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

 

I would suggest you do the following:

 

1.       Create a new root directory for your project.

2.       Create your POM file in this directory (pom.xml)

3.       Create the src/main/java directory structure

4.       In the java directory create your first java class

 

Once you have done this perform a:

 

“mvn clean install –U”

 

This will download all of the dependencies that you require from the maven central repo and build your project for you.  You don’t need to manually download or extract anything maven will do it all for you.

 

Even though you are using Maven it is still a Java project.  Maven at its most basic is a dependency management/build system that was originally designed to be used with Java, but you can use it with others things as well (e.g. scala).  For more info have a look at http://maven.apache.org/what-is-maven.html.

 

I’m not an Eclipse user and not a big fan of Eclipse, so I may well be biased with this recommendation, but I would suggest using an IDE that supports POM files out of the box like IntelliJ IDEA, or even Netbeans.  My personal preference is IntelliJ IDEA which has some excellent GIT support in the latest version:

 

http://www.jetbrains.com/idea/download/

 

You can then just open your POM file with the IDE and it will load the maven project into the IDE for you, no configuration of a maven plugin, no running IDE specific maven commands, no faffing, it will just work.

 

I have really just scratched the surface, but hopefully there is enough above to get you going.

 

-----Original Message-----
On Behalf Of Glenn
Sent: 30 March 2012 18:28
To: Selenium Users
Subject: [selenium-users] errors after install: Trying to run Selenium on Windows7 in java via Eclipse

 

After having some issues after my first attempt, I reinstalled to make sure that I did everything correctly, but now I'm getting a ton of errors that I didn't get before.

 

Basically, I just want to get this working. If I recall correctly from the site, trying to do the remote stuff is harder to get going then just running on the same machine. If someone can help me out with doing just one machine, that would be fine, but I do need to test diff browsers (firefox, IE, Chrome and Safari) on Windows at the minimum (I'll worry about diff OS's later).

 

Here are the steps that I'm doing (please let me know if I'm doing something wrong.. tried to follow from the Selenium site as much as possible).

 

- created a new directory to house the project and install

- created the pom.xml file per the example on the selenium site (updated the versions to match was I have).

- extracted the selenium-java-2.20.0.jar into the directory

- extracted the selenium-server-standalone-2.20.0.jar

  - though I am confused by the statement on the selenium site regarding the server having a dependency on servlet api and that it should be excluded if my project is run inside a web app container..?

- performed the mvn clean install

- performed mvn eclipse:eclipse

- opened Eclipse and did the import of the project .. was planning on using the same directory my workspace, but apparently you can't do that in Eclipse, so created new directory for the workspace and finished the import.

  - choose to use PortableGit

 

I then tried to create a java class to run the Selenium2Example class that is given on the site for googling "cheese" (btw: the question came up, that since it's mvn that's creating the project (or at least laying the foundation) _is_ that project a java project???) I was given an error regarding the package, so I tried taking the reference out, but then put it back in and now for some reason I don't get the error on the package (should I have installed something for that?).

 

Now, tho, my run was not working, tried the "Validate" option and got a TON of errors..

Description         Resource             Path       Location               Type

A '(' character or an element type is required in the declaration of

element type "simpleType".       datatypes.dtd   /MySel202Proj/javax/servlet/

resources            line 110 DTD Problem

Description         Resource             Path       Location               Type

cvc-elt.1: Cannot find the declaration of element 'web-app'.

webdefault.xml                /MySel202Proj/org/openqa/jetty/jetty/servlet                line 26

XML Problem

Description         Resource             Path       Location               Type

cvc-elt.1: Cannot find the declaration of element 'web-app'.

webdefault.xml                /MySel202Proj/org/seleniumhq/jetty7/webapp               line 26   XML

Problem

Description         Resource             Path       Location               Type

Named template str is not available        mbean_attributes.xsl    /MySel202Proj/

mx4j/tools/adaptor/http/xsl      line 23   XSL Problem

...

on and on.. but this is all stuff that was installed.. therefore I feel that I must have done something wrong on the install itself..

 Please advise if you can.

 Kind Regards,

Glenn