0

I'm writing a test suite with RF with Selenium for Java, using Hi-Fi's SeleniumLibrary.

I'm implementing some high-level keywords using variables kept in a Variables.robot file like this:

*** Variables *** ${EXPECTED URL} https://www.test.com 

And this file is being imported in my Resource.robot, to be used in keywords, like this:

*** Keywords *** Main Links Are Working Wait Until Element Is Visible ${SIGN UP IMG} ${link} Get Element Attribute ${SIGN UP IMG}@href Should Be True ${link}==${EXPECTED URL}/signup/new 

This is what I get when executing:

Evaluating expression 'https://www.test.com/signup/new==https://www.test.com/signup/new' failed: SyntaxError: mismatched input ':' expecting EOF (<string>, line 1) 

(I had to replace the actual company url for a dummy url in my examples but I tried to keep a similar url structure)

I'm not sure what's going on. As far as I can see, it's comparing two exactly matching URLs, but somehow it's not recognizing the ':' character. I tried escaping it with a backslash (:) but the same error shows up.

    1 Answer 1

    2

    The expressions need to be valid python expressions after all of the variables have been substituted. You either need to add quotes, or use the special $variable syntax (see Evaluating Expressions in the BuiltIn library documentation):

    Should Be True '${link}'=='${EXPECTED URL}/signup/new' 

    -or-

    Should Be True $link == $expected_url 
    1
    • Ohh, so adding quotes make these literal strings that can be compared, right?
      – Floella
      CommentedJan 15, 2018 at 20:55

    Start asking to get answers

    Find the answer to your question by asking.

    Ask question

    Explore related questions

    See similar questions with these tags.