首页 > 解决方案 > 如何使用 Selenium2Library 在 Robot Framework 中使用 RIDE 在动态表中添加数据

问题描述

您好,我是测试新手。我想通过在动态生成的表中添加值来测试应用程序。请帮助我如何在表格中添加价值,使用机器人框架和 RIDE。

*Settings*

 Library Selenium2Library  

 ** Variables **

 ${AddWhiteCityCode}    Pune

 ** Test Cases **

 Click AddWhiteCity
  Click AddWhiteCity

 ** Keywords **

   Click AddWhiteCity

      Input Text    xpath=(//td[contains(@class,"addWhiteCity"')])[1]  ${AddWhiteCityCode}

我已经尝试了上述语法,但给出了 Invalid Xpath syntax Error Please help..

谢谢

抱歉,这是复制粘贴错误,我的代码中没有单引号。

这是我的实际代码。

Input Text xpath=(//td[contains(@class,"addWhiteCity")])[1] ${AddWhiteCityCode}

标签: seleniumrobotframework

解决方案


你有单引号。因此,您将收到无效的 xpath 错误。

xpath=(//td[contains(@class,"addWhiteCity")])[1]

推荐阅读