Scripts recorded in Selenium IDE can be easily transferred to and run from the WebDriver. You just have to export the test case from IDE in your preferred programming language & testing framework.
Note: The exported test case would run on Firefox by default.
Following are the steps that are to be followed to export your test case:
- Select the Test Case that is to be exported
- Go to > File menu
- Select Export Test Case As
- Choose your preferred option.
For example: If java is the preferred language then save the test case as ‘.java’ format.
Further, add the selenium language bindings (http://docs.seleniumhq.org/download/) to your Eclipse project build path.
Following are the steps need to be followed:
- Right-click the project folder and select Build Path
- Build Path -> Configure Build Path
- Configure Build Path -> Add External JARS
- Select the location where you have stored the JARS on your local machine and import all the JARS
- Once the above steps are completed copy the exported test case file into your Eclipse workspace.
- Run the file from eclipse and it’s done.
For example: If the test case was exported as TestNG then simply right-click the file > Run As > TestNG Test
This process allows you to test on multiple web browsers by pushing away the limitation of IDE which only runs on Firefox.
Prerequisites:
- Eclipse IDE (https://eclipse.org/downloads/)
- JDK 1.6 or above (http://www.oracle.com/technetwork/java/javase/downloads/index.html)
- Basic knowledge of any of the following programming languages: Java, Python, C#, Ruby etc.