[SeleniumConf Chicago] Tickets are on sale and CFP is open NOW! Go HERE for details x
[SeleniumConf Chicago] Tickets are on sale and CFP is open NOW! Go HERE for details x

Donate to Selenium

with PayPal
through sponsorship

You can sponsor the Selenium project if you'd like some public recognition of your generous contribution.

Selenium Sponsors

See who supports the Selenium project.

Sauce Labs Experitest New Relic Synthetics

Programming Language Preference

Importing Sel2.0 Project into Eclipse using Maven

Once you have created your pom.xml file in your project, you can have maven autogenerate the project files necessary for eclipse with a simple command:

mvn eclipse:eclipse

Then open eclipse. Choose your workspace or create a new one. Once the Eclipse IDE loads, do the following:

# File -> Import… # General -> Existing Projects into Workspace # Click next # Next to “Select root Directory:” click “Browse” button # locate the project folder containing your pom.xml and click ok. # Your project should appear in the “Projects” box already # click finish

If you haven’t already, install the m2eclipse plugin then right click on your project and select Maven -> Enable Dependency Management.

Importing Sel2.0 Project into IntelliJ Using Maven

We are currently working on this appendix. The information provided here is accurate, although it may not be finished.

In this appendix we provide the steps, including screen captures, showing how to create a Selenium 2.0 java client-driver project in IntelliJ IDEA. These steps assume you have already used maven with a pom.xml file to set up the project. This process is described in the Selenium 2.0 chapter. You must have followed that process before you can perform these steps. This appendix then shows you how to import the maven-created Selenium 2.0 java project into IntelliJ.

First, open IntelliJ and from the entry page, click Create New Project.


From the New Project dialog select Import Project from External Model.


From the list of project types, select maven.


Now you will see a dialog allowing you to set project options including the project’s root directory.


Click the ‘…’ button to set the root folder.


Now the settings dialog will show the directory you just selected.


This next dialog shows the name of your maven project as specified in the pom.xml file. Select your maven project and continue.


Enter a name for your project.


Once your project has been imported it should look like this in IntelliJ.


The maven project download many dependencies (libraries) when you originally ran ‘mvn install’. Now in IntelliJ you can see all these libraries. These next two screen captures shows the libraries you should now have in your project.

_images/Appendix_Sel20_Java_Img09_Libraries1.png _images/Appendix_Sel20_Java_Img10_Libraries2.png

Before you can start writing Selenium code, you still need to create a module and at least one Java class (a .java file). First select the Project’s root in IntelliJ and right click.


And select Create Module.


In the dialog select the radio button Create Module From Scratch.


Select Java Module and enter a name for the new module.


And next, you must create a folder for the source code. By convention this is almost always named ‘src’.


Now we’re on the last dialog. Typically you don’t need to select any ‘technollogies’ here. Unless you know for a fact you will be using Groovy or some other technology.


Now that the module is created, your project should show the following structure.


Finally, you need to create a .java file with a corresponding java class.


Enter the class name.


The .java file should now be created. It should look like this in your project.


If your project now looks like the one displayed above, you’re done, congrats! And hope you enjoy coding your first Selenium automation!