I am trying to utilize a global variable that I set by passing it in as an argument to a keyword but it is not working for some reason. Here's the code:
*** Variables ***
${ENV} qa
${MOBILE} 0
${BROWSER} Chrome
${DELAY} 0
${VALID USER} username
${VALID PASSWORD} 123456
&{SERVER} qa=https://${PREFIX}.qa.myapp.com
... staging=https://${PREFIX}.staging.myapp.com
... prod=https://${PREFIX}.myapp.com
${LOGIN URL} ${SERVER.${ENV}}/
${WELCOME URL} ${SERVER.${ENV}}/Profile
*** Keywords ***
Begin Web Test
[Arguments] ${pf}
[Tags] Critical
Set Global Variable ${PREFIX} ${pf}
Open Browser ${LOGIN URL} ${BROWSER}
Run Keyword If ${MOBILE} == 1
... Set Window Size 50 800
... ELSE Maximize Browser Window
Set Selenium Speed ${DELAY}
Login Page Should Be Open
Input Text username ${VALID USER}
Input Text password ${VALID PASSWORD}
Click Button btn_login
Location Should Be ${WELCOME URL}
Page Should Contain Update Profile
When I run this I receive an error:
[ ERROR ] Error in file '/path/to/Common.robot': Setting variable '&{SERVER}' failed: Variable '${PREFIX}' not found.
Could someone explain why this doesn't work?