How to compare two strings equal or not in Robot Framework

python, robotframework, selenium-webdriver, webdriver

Solution

Yes, that is the correct way of storing variables. Though you can also do it without the equal sign:

${xyz}    Get Text    xpath=/html/body/div/div[2]/div[3]/div/div/div/div/h3
${abc}    Get Text    xpath=/html/body/div/div[2]/div[4]/div/div/div/div/h3

Now that you have the two different strings assigned to variables, you can simply do:

Should Be Equal As Strings    ${xyz}    ${abc}

You can see the documentation for `Should Be Equal As Strings` here.

Problem

How to compare two strings equal or not in Robot Framework. For example: ``` ${xyz}= Get Text xpath=/html/body/div/div[2]/div[3]/div/div/div/div/h3 ${abc}= Get Text xpath=/html/body/div/div[2]/div[4]/div/div/div/div/h3 ``` These xpath values are getting different strings. So how to compare there strings equal or not? Is it correct way to storing the values in variable in Robot Framework?

Original source