errors after install: Trying to run Selenium on Windows7 in java via Eclipse

205 views
Skip to first unread message

Glenn

unread,
Mar 30, 2012, 1:28:19 PM3/30/12
to Selenium Users
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

Mark Collin

unread,
Mar 30, 2012, 5:34:06 PM3/30/12
to seleniu...@googlegroups.com

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.

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To post to this group, send email to seleniu...@googlegroups.com.

To unsubscribe from this group, send email to selenium-user...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.

 

Glenn Bagrowski

unread,
Apr 5, 2012, 11:43:49 AM4/5/12
to seleniu...@googlegroups.com
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

Rino van Dam

unread,
Apr 5, 2012, 1:12:58 PM4/5/12
to seleniu...@googlegroups.com
In my humble opinion, telling beginners (like myself) to use Maven is wrong.  One more tool to learn before you can even get started with  WebDriver.

I gave up and simply:
- installed java, 
- then eclipse, 
- then downloaded the Selenium WebDriver java classes
- then started a new project in eclipse
- then added the WebDriver jars to the project ( Project | Properties | Libraries tab | Click 'Add External JAR' | add all  WebDriver files you downloaded)

That's it.  Leave Maven for a later date.

Mike Riley

unread,
Apr 5, 2012, 1:23:34 PM4/5/12
to seleniu...@googlegroups.com
I agree with you.  I do the same with Netbeans, which can use either ANT or Maven if I wished to bother.  By using the TestNG and configuring it programmatically I can simply start my tasks from the command line in a batch or script file with no need to use ANT or Maven.  Later I will explore how those might be useful, but for now I am productive this way.

Mike

Mark Collin

unread,
Apr 5, 2012, 3:03:51 PM4/5/12
to seleniu...@googlegroups.com

It’s asking you to select the Java SDK to use with your project.

 

Assuming IntelliJ IDEA 11:

 

Click File -> Project Structure…

Select 1.7 in the drop down box under project SDK:  (Default will be <No SDK>)

Click OK

 

If you have created the basic maven structure suggested below all you need to do is open the POM with intelliJ IDEA, it will then create the IDEA project structure for you automatically.

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/h8UB6j4tb2AJ.

Mark Collin

unread,
Apr 5, 2012, 3:12:49 PM4/5/12
to seleniu...@googlegroups.com

I disagree, generally speaking you are going to need to start using ANT and/or Maven in the future when you want to plug your tests into CI, or run them using a cron job/scheduled task anyway.  Bearing this in mind why not start learning ANT/Maven at the outset?  It will affect your decisions on how to build your test framework and even though it’s a slightly higher learning curve to begin with it will pay huge dividends in the long run.

 

I agree that Maven with Eclipse is a black art as Eclipse doesn’t support Maven out of the box (Personally I’m not a big fan of Eclipse anyway) which is why I would always recommend a IDE that supports maven out of the box to make your life easy whilst starting up.

 

The big positive for maven in my mind is that it controls all of the dependency management and classpath settings for you so once you have a basic POM you don’t need to worry about it. 

 

I’ve worked with a lot of people who have had real problems with various jars, jar versions, the classpath and general projects structure.  Maven generally fixes all of these problems by forcing a sane project structure upon you and dealing with dependencies and classpaths so you don’t have to worry about it.

--

You received this message because you are subscribed to the Google Groups "Selenium Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/5an71Sv8Im8J.

Krishnan Mahadevan

unread,
Apr 5, 2012, 3:18:06 PM4/5/12
to seleniu...@googlegroups.com
I second Mark on that although I have only used eClipse till now. 
With the standalone version of maven I still get things done on the command mode when eclipse gets cranky :)

Without knowing a build tool the max you are going to get to is being able to execute tests via
1.  Command prompt using batch or shell scripts (or)
2. Via the IDE. 
--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
Reply all
Reply to author
Forward
0 new messages