8

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.

Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
max
  • 3,047
  • 5
  • 20
  • 17

5 Answers5

8

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.

Adrian
  • 2,233
  • 1
  • 22
  • 33
user861594
  • 5,733
  • 3
  • 29
  • 45
  • There is no `options` or `file` button?! – winklerrr Apr 19 '18 at 16:08
  • Yes it was available in old version but not in the new version. May be new version will add all features which are available in legacy. However you can post in QAF users group to support SIDE project in addition to BDD KWD and Java so you user don't need to export to junit/testng/qaf. Note: isfw is now renamed as [qaf](https://qmetry.github.io/qaf) – user861594 Apr 27 '18 at 18:33
  • 1
    I found an alternative plugin (available for Chrome & Firefox) which is build on the new selenium framework and which offers the possibility to export code (python, Java, etc.). It's called [Katalon Recorder](https://www.katalon.com/) – winklerrr Apr 27 '18 at 19:30
2

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
Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
2

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.

Katalon Recorder

winklerrr
  • 13,026
  • 8
  • 71
  • 88
0

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

0

With version 4 of Selenium IDE, the export into multiple languages is possible directly from Selenium IDE:

source: https://expleoacademy.com/int/6-steps-to-create-and-export-selenium-ide-tests/

1.

Side pane with Tests, mouse hovering over "..." option of one test

2.

shows export menue, visiable after clicking the "..." option. Mouse hovering over the entry "Export"

3.

bullet points to selected export language and framework (C#, Java, JavaScript, Python, Ruby), as well as further export options