selenium-webdriver - 我可以将 Selenium IDE 测试转换为 Java 中的 Selenium webdriver 测试吗

标签 selenium-webdriver selenium-ide ghost-inspector

我正在使用 Ghost 检查器记录我的测试。它确实允许我以 Selenium IDE 格式导出测试。我将来可以使用导出的测试来编写 Selenium Web 驱动程序测试吗(JAVA)

导出的测试看起来像这样:

  1. 导航 waitForPageToLoad
    waitForElementPresent css=.explore-nav-label
    单击 css=.explore-nav-label
    等待页面加载

最佳答案

全面披露:我在 Ghost Inspector 工作。

看起来 Selenium IDE 团队最近 added the ability to export tests来自新的 Selenium IDE v3,太棒了!

只涉及几个步骤:

从 Ghost Inspector 导出

来自Ghost Inspector dashboard ,导航到您的测试并选择更多 > 导出此测试,然后选择新 Selenium IDE (.side) 格式:

enter image description here

点击下载并将文件保存在方便的地方。

使用 Selenium IDE 导入(和导出)

导入到 Selenium IDE 中就像打开刚刚从 Ghost Inspector 下载的 .side 文件一样简单。打开文件后,您可以右键单击测试并在左侧 Pane 中选择导出。从那里您将有多种格式可供选择,包括 Java JUnit:

Export .side tests to JUnit

一些注意事项

请记住 Ghost Inspector step actionsSelenium IDE commands还不是完美的一对一匹配,因此 Ghost Inspector 中的一些操作将显示为 Selenium 格式的 JavaScript 操作。您可能需要根据需要对最终测试进行一些调整。

希望有帮助!

关于selenium-webdriver - 我可以将 Selenium IDE 测试转换为 Java 中的 Selenium webdriver 测试吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60121153/

相关文章:

java - Webelement.click() 在 appium 中给出 java.lang.NullPointerException

javascript - (节点:19502) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'indexOf' of undefined

javascript - 从 Selenium Webdriver 中的 JQuery 脚本返回值

javascript - 日期变量函数以 dd/mm/yyyy 格式包含在未来 x 天之前的 Selenium IDE 中

javascript - Selenium 二维数组

jquery - 使用jquery和selenium IDE 1.0.8获取元素

automation - 如何在 Ghost Inspector 中通过 xPath 查找元素

selenium - Chromedriver : cannot execute binary file