title: How to run if if else condition based on element visibility in selenium robot framework?
body: <p>I am automating a user registration form flow, where successful registration shows a success message and any validation error throws alert text. For this, I am writing an if-else flow based on the visibility or presence of an element on the page. I will pass the control to a specific keyword with that condition </p>
  
  <p>${SuccessBreadcrumb} is the element which is visible when the registration is successful</p>
  
  <p><strong>Code Snippet</strong></p>
  
  <pre><code>*** Settings ***
  Library  SeleniumLibrary
  
  *** Variables ***
  ${SuccessBreadcrumb} =  xpath=//a[contains(text(),'Success')]
  ${SuccessMsgLocator} =  xpath=//p[contains(text(), 'successfully created')]
  ${AlertMsg} =  xpath=//div[@class='text-danger']
  
  *** Keywords ***
  Verify Validation Message
      [Arguments]  ${UserDetails}
      sleep  2s
      run keyword if  ${SuccessBreadcrumb}  is visible  Keyword 1
  #   ...  else  Keyword 2
  
  
  Keyword 1
      [Arguments]  ${UserDetails}
      ${AccountCreatedText} =  get text  ${SuccessMsgLocator}
      should contain  ${AccountCreatedText}  ${UserDetails.ValidateMsg}  ignore_case=true
  
  # Keyword 2
  </code></pre>
  
  <p><strong>Error Log</strong></p>
  
  <pre><code>Run Keyword If ${SuccessBreadcrumb}, is visible, VerifySuccessText
  Documentation:  
  Runs the given keyword with the given arguments, if condition is true.
  
  Start / End / Elapsed:  20200213 12:27:52.882 / 20200213 12:27:52.882 / 00:00:00.000
  12:27:52.882    FAIL    Evaluating expression 'xpath=//a[contains(text(),'Success')]' failed: SyntaxError: invalid syntax (&lt;string&gt;, line 1)
  </code></pre>