power_settings_new

How to configure selenium webdriver in eclipse?

by (473 points)
asked
0 votes
33 views
How to configure and start working selenium webdriver in eclipse?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.

1 Answer

answered by (1.1k points)
0 votes
 
Best answer

Setting up Selenium in Eclipse IDE is very simple.

Just like another Java project, create a new project in Eclipse IDE.

  1. Inside Eclipse select the menu item File > New > Project.... to open the New Project wizard
  2. Select Java Project then click Next to start the  Open the new Java project wizard New Java Project wizard:
    • On this page,
    • type "JUnit" in the Project name field, and
    • select "J2SE-1.4" in the Use an execution environment JRE field.
    • Then click Finish.
  3. In the Package Explorer, expand the JUnit project and select the source folder src.
  4. Select the menu item File > Import...
  5. Expand General, select Archive file, and click Next.
  6. Click the Browse button next to the Archive file field and browse to select
    • <Downloads>/junit381src.jar
    • Note: This step assumes that you followed steps 1 and 2 in the Getting the Sample Code section above.
  7. In the Import wizard, expand the root node, press Deselect All and select only the JUnit node. You can expand and select elements within the JUnit directory on the left pane to view the individual resources that you are importing in the right pane. Note: Do not deselect any of the resources in the JUnit directory at this time. You will need all of these resources in the tutorial.
  8. Make sure that the JUnit project's source folder appears in the destination Into folder field. Then click Finish. In the import progress indicator, notice that the imported resources are compiled as they are imported into the workbench. This is because the Build automatically option is checked on the Workbench preferences page.
  9. In the Package Explorer view, expand the JUnit project and the src folder to view the JUnit packages.

So, now you have a basic project setup ready.

You can now download(http://www.seleniumhq.org/download/) and add Selenium libraries to your Eclipse project.

Below are steps to add your Selenium JARs to the Eclipse project.

  • Eclipse -> Preferences -> Java -> Build Path -> User Libraries -> New(Name it) -> Add external Jars
  • (I recommend dragging your new libraries into the eclipse folder before any of these steps to keep everything together, that way if you reinstall Eclipse or your OS you won't have to link anything except the JDK) Now select the jar files you want. Click OK.
  • Right-click on your project and choose Build Path -> Add Library
  • FYI just code and then right click and Source->Organize Imports

 That's all.

add
...