【问题标题】:How to integrate embedded variables on RobotFramework Keywords如何在 Robot Framework 关键字中集成嵌入变量
【发布时间】:2021-01-18 06:05:36
【问题描述】:

我想知道如何做这样的事情:

资源文件:

*** Settings ***
Library SeleniumLibrary

*** Keywords ***

Open Outdoor Menu
   Click Element  id:outdoor_menu

Check Outdoor Monitor Specs
    Page Should Contain Element  id:outdoorpossible

Check Monitors Specs
    [Arguments]   ${Menu}
    Open ${Menu} Menu
    Check ${Menu} Monitor Specs

我有不同的 ${Menu} 监视器,这样的东西真的很有帮助。 所以我的测试是这样的:

...
Test Template   Check Monitors Specs

*** Test Cases ***
Outdoor Menu  Outdoor
Station Menu  Station
etc.

我试试这个并给我这个错误:“没有找到名称为'Open ${Menu} Menu'的关键字。” 你对我如何实现这样的事情有任何想法吗? 非常感谢

【问题讨论】:

标签: python selenium robotframework keyword


【解决方案1】:

您需要使用“运行关键字”

Check Monitors Specs
   [Arguments]   ${Menu}
   Run Keyword  Open ${Menu} Menu   
   Run Keyword  Check ${Menu} Monitor Specs

【讨论】:

    猜你喜欢
    • 2015-10-09
    • 1970-01-01
    • 2018-12-20
    • 2016-09-17
    • 2015-03-29
    • 2021-01-11
    • 2019-04-26
    • 2015-12-04
    • 2011-11-26
    相关资源
    最近更新 更多