I'm working on a Robot Framework project with Selenium on Java.
The website I'm testing has a language dropdown element to switch the page language. Whenever a new language is selected, the "lang" attribute in the html tag changes. E.g., it goes from <html lang="en">
to if Spanish is selected from the list.
This is what I'm using to test the language switch:
Select From List By Value ${DROPDOWN} ?hl=es
${language} Get Element Attribute html@lang
Wait For Condition ${language}==es timeout=15s
Even though I can see the page switching languages, and I can inspect the DOM while the test is running and I see the lang
attribute switching to the new language, I keep getting Condition 'en == es' did not become true in 15 seconds
. I tried adding quotes to make the comparison about strings but to no avail. I also tried increasing the timeout.
I can't understand why the condition keeps returning false when I'm seeing live (while the test executes) that the language has indeed changed: