【问题标题】:If statement in RobotRobot 中的 if 语句
【发布时间】:2019-08-16 22:08:02
【问题描述】:

我有这个机器人代码:

Load staging server if available
    Open Browser    http://abc  Firefox
    ${text}=  Get Text  //h4
    Run Keyword If  ${text} != Hooray  Go To  http://xyz

在这我得到错误:Evaluating expression 'Hooray != Hooray' failed: SyntaxError: invalid syntax (<string>, line 1)

如果abc 中的标头标签不包含单词hooray 重定向到xyz

根据这个主题how to use "Run Keyword If" in robot framework 它应该可以工作,但不能。我在这里做错了什么?

【问题讨论】:

    标签: selenium-webdriver robotframework


    【解决方案1】:

    看到这个答案:Use of "If statement" in robot framework

    尝试改变:

    Run Keyword If  ${text} != Hooray  Go To  http://xyz
    

    到:

    Run Keyword If  "${text}" != "Hooray"  Go To  http://xyz
    

    【讨论】:

    • 是的……就是这样。我需要为这些值添加引号。将尽快接受作为答案。
    猜你喜欢
    • 2021-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-14
    • 2011-12-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-24
    相关资源
    最近更新 更多