Search code examples
robotframeworkselenium2library

In robot framework Can we use Element Should Be Visible in Run Keyword If


I am using this code:

Run Keyword If Element Should Be Visible    ${PO_Mail_Subject}

I'm using Element Should Be Visible in Run Keyword If and getting Evaluating expression 'Element Should Be Visible' failed: SyntaxError: invalid syntax (<string>, line 1).

I don't know whether my code is valid or not. Can anyone help me out!!


Solution

  • Try it in this way:

    ${Status}=    Run Keyword And Return Status     Element Should Be Visible ${PO_Mail_Subject}
    Run Keyword If    '${Status}'=='TRUE'     Element Text Should Be    <Locator>    <Mail Content>    ELSE    < Do iteration Operation>