More details about "if" parameters


#1

Hi!

Kantu n00b here (3 hours)

When opening a url at the start of a macro, there may be a redirect to a login page first. How do I detect that in the “if” clause (eg check the url, or recognize something unique to the login page)?

I’m sure this will be a very common question. More examples of valid “if” tests on the manual page would also be appreciated.

Anyways… this thing is very cool! Thanks.


#2

You can use e. g. verify Text to check if you are on the right page. If verifyText or any other command fails, then the internal variable !statusOK will be false.

Therefore you can do this:

  • verifyText | //*[@id="content"]/div[2]/div/h2[1] | Login Page Text
    
  • if | "${!statusOK}" == "false" |
    
  •     echo | we are not on the login page
    
  • endif