如何将selenium IDE中记录的命令转换为Java?

Ami*_*ith 26 java selenium selenium-ide selenium-webdriver

是否有任何应用程序或简单的方法来记录通过的所有命令转换Selenium IDEJava (Selenium WebDriver)?这将更容易,并将节省大量时间.

任何建议将不胜感激.谢谢!

Pav*_*cek 31

在我的Selenium IDE版本2.4.0中,它很容易:

  1. 在Selenium IDE中记录测试用例
  2. 单击文件 - 将测试用例导出为 - Java/JUnit4/WebDriver
  3. 将文件另存为.java

你走吧!您的测试用例转换为WebDriver;)


Har*_* G. 11

更新:从SeleniumIDE 3.x开始,遗憾的是前面的答案"Export"和"Options-> Format"中提到的两个函数都被删除了(原因是移植到Firefox和Chrome的新WebExtensions格式).

但目前的替代品是Katalon Recorder,可用于ChromeFirefox.

Katalon Recorder有一个"导出"按钮,可以使用TestNG,JUnit以及Thoughtworks WebDriverBackedSelenium和JUnit导出3种Selenium格式.

只需按"导出",选择您的格式,而不是"复制到剪贴板"或"另存为文件...".


Ank*_*ain 7

在我的Selenium IDE版本2.4.0中

Record a new test case with the help of Selenium IDE

 1) Click on File a primary nav bar
 2) check drop down is displayed
 3) select on Export test case as 
 4) Check you can convert selenium test case in any language EG: Java / JUnit4 / WebDriver

Save File as .java
Your testcase is converted to WebDriver
Run Code Online (Sandbox Code Playgroud)

检查图像 在此输入图像描述

  • 在最新版本的IDE中,我没有看到任何菜单选项?我在放松自己的想法吗? (2认同)