Programming Language Preference
Selenium 1.0 Java Client Driver Configuration¶
In General configuration of Selenium-RC with any java IDE would have following steps:
- Download Selenium-RC from the SeleniumHQ downloads page
- Start any java IDE
- Create new project
- Add “selenium-java-<version-number>.jar” to your project classpath
- Record your test from Selenium-IDE and translate it to java code (Selenium IDE has automatic translation feature to generate tests in variety of languages)
- Run selenium server from console
- Run your test in the IDE
These points have been delineated below with reference to Eclipse and IntelliJ:
Configuring Selenium-RC With Eclipse¶
Eclipse is a multi-language software development platform comprising an IDE and a plug-in system to extend it. It is written primarily in Java and is used to develop applications in this language and, by means of the various plug-ins, in other languages as well as C/C++, Cobol, Python, Perl, PHP and more.
Following lines describes configuration of Selenium-RC with Eclipse - Version: 3.3.0. (Europa Release). It should not be too different for higher versions of Eclipse
- Launch Eclipse.
- Select File > New > Other.
- Java > Java Project > Next
- Provide Name to your project, Select JDK in ‘Use a project Specific JRE’ option (JDK 1.5 selected in this example) > click Next
- Keep ‘JAVA Settings’ intact in next window. Project specific libraries can be added here. (This described in detail in later part of document.)
- Click Finish > Click on Yes in Open Associated Perspective pop up window.
This would create Project Google in Package Explorer/Navigator pane.
- Right click on src folder and click on New > Folder
Name this folder as com and click on Finish button.
- This should get com package insider src folder.
- Following the same steps create core folder inside com
SelTestCase class can be kept inside core package.
Create one more package inside src folder named testscripts. This is a place holder for test scripts.
Please notice this is about the organization of project and it entirely depends on individual’s choice / organization’s standards. Test scripts package can further be segregated depending upon the project requirements.
- Create a folder called lib inside project Google. Right click on Project name > New > Folder. This is a place holder for jar files to project (i.e. Selenium client driver, selenium server etc)
This would create lib folder in Project directory.
- Right click on lib folder > Build Path > Configure build Path
- Under Library tab click on Add External Jars to navigate to directory where jar files are saved. Select the jar files which are to be added and click on Open button.
After having added jar files click on OK button.
Added libraries would appear in Package Explorer as following: