Standard tickets for SeleniumConf Berlin are on sale NOW (while supplies last)! For details GO HERE x
Standard tickets for SeleniumConf Berlin are on sale NOW (while supplies last)! For details GO HERE 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.

_images/Appendix_Sel20_Java_Img01_EntryPage.png

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

_images/Appendix_Sel20_Java_Img02_ImportProject.png

From the list of project types, select maven.

_images/Appendix_Sel20_Java_Img03_SelectMaven.png

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

_images/Appendix_Sel20_Java_Img04_RootDirAndProjOptions.png

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

_images/Appendix_Sel20_Java_Img04a_SetRootFolder.png

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

_images/Appendix_Sel20_Java_Img05_RootFolderSet.png

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

_images/Appendix_Sel20_Java_Img06_SelectTheMavenProject.png

Enter a name for your project.

_images/Appendix_Sel20_Java_Img07_ProjectName.png

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

_images/Appendix_Sel20_Java_Img08_ProjectImported.png

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.

_images/Appendix_Sel20_Java_Img11_CreateModuleSelectProject.png

And select Create Module.

_images/Appendix_Sel20_Java_Img12_SelectCreateModule.png

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

_images/Appendix_Sel20_Java_Img13_CreateModuleFromScratch.png

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

_images/Appendix_Sel20_Java_Img14_JavaModuleAndModuleName.png

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

_images/Appendix_Sel20_Java_Img15_CreateSrcFolder.png

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.

_images/Appendix_Sel20_Java_Img16_SelectTechnologiesNoGroovy.png

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

_images/Appendix_Sel20_Java_Img17_ModuleCreated.png

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

_images/Appendix_Sel20_Java_Img18_SelectCreateJavaClass.png

Enter the class name.

_images/Appendix_Sel20_Java_Img19_EnterJavaClassName.png

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

_images/Appendix_Sel20_Java_Img20_JavaClassCreated.png

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