How to convert commands recorded in Selenium IDE to Java?


We can convert commands recorded in Selenium IDE to Java. To convert commands first navigate to File menu, then select the option Export Test case As.

After clicking it, all the possible options for conversion get displayed. Choose the option Java/ Junit 4/ WebDriver.

Finally, we have to save the file with the .java extension. Then we can open this file using a text Editor or IDE.

We can also convert commands recorded in Selenium IDE to Java by navigating to the Options menu. As the Selenium IDE Options pop−up comes up, select the checkbox Enable experimental features. Then click on OK.

Next, select the Options. Choose the Format as Java/ Junit4/ WebDriver. From the JavaScript Applications pop−up, click on OK.

We also have the option to convert each Selenium command to Java with the steps are listed below −

  • Launch Firefox, then open Selenium IDE.

  • Record steps for a test.

  • Go to Options from the Selenium IDE.

  • Select the option Clipboard Format.

  • Choose Java / TestNG/ WebDriver.

  • Right−click on any command recorded, then click on Copy.

  • Paste it in any IDE like Eclipse or IntelliJ or any text editor like WordPad, NotePad++, and so on.

  • We shall have the command pasted in Java format.

Similar steps can be followed to convert the same commands to other languages like Python, C#, and so on. Another way to convert a test to Java is to right-click on the test, then select the option Export.

The select Java JUnit option. Click on Export.

Finally, save it in a file with .java extension.

Updated on: 01-Feb-2021

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements