Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate Java source code from Selenium IDE (IDE code is in HTML extension)

I am using Selenium IDE (a Firefox plugin) for doing testing. I am unable to see java code when I start recording something. What I see always is HTML. Any idea what can be the best way to get the java source code. Please any one can help on this.

Thanks a lot.

like image 447
max Avatar asked Nov 03 '11 06:11

max


2 Answers

Below are steps:

  1. Options->Format -> select format of your choice eg. junit/testng/isfw
  2. Go to Source tab.

To export test case in specific format use

File->Export Test Case As -> select format

One of the useful feature of Selenium IDE is, it provide option to set clipboard format so that you can copy commands form table view and paste in format of your choice of language.

Options->Clipboard Format -> set format

Here is the selenium IDE documentation.

like image 74
user861594 Avatar answered Oct 09 '22 16:10

user861594


There are 2 ways for the Java code in Selenium IDE:

1st way: By exporting recorded test case(HTML format) into java file:

  1. Record your tests in HTML format by using Selenium IDE
  2. File -> Export Test Case As -> Java / JUnit4/ WebDriver
  3. Save the file (it would be saved as .java and this will show your expected Java code)

2nd way: To see the Java code directly in Selenium IDE

  1. Go to Options -> Options...
  2. At "Selenium IDE Options" window: Check the check box for "Enable experimental features" and click OK button
  3. Options -> Format -> Java / JUnit4 / WebDriver
  4. Click OK button from "JavaScript Application" pop up -> You will see the desired Java source code for your recorded tests
like image 38
Ripon Al Wasim Avatar answered Oct 09 '22 17:10

Ripon Al Wasim