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

ⅰ亾dé卋堺 提交于 2019-12-03 08:29:15
user861594

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.

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

The current version of Selenium IDE (version: 3.0.2) doesn't seem to support the "export to code" functionality.

But there is an alternative plugin which also uses the new Selenium framework (version: 3+) and still offers the possibility to export tests directly to code (python, Java, etc.). It's called:

Katalon Recorder (available for Chrome & Firefox, for free!)

As you can see in the picture below: there is an "Export" button in the top menu bar.

Go to option, click on Enable Experiment Feature, click OK Click oK when popUp. Now again check option>Format>select ur desired format. Code will be display on "source" tab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!