RobotFramework: Variable ‘${username}’ not found

  python, robot, robotframework, selenium, variables

I just wanna ask for some help with this error. I really can’t fix it.

I don’t know if it has something to do with this other error [ ERROR ] Calling method ‘_start_suite’ of listener ‘DataDriver’ failed: XLRDError: Excel xlsx file; not supported

but I already upgraded my datadriver and I am using python 2.7.17. Please help me. Thank you very much!

login_resources.robot

     *** Settings ***
     Library     SeleniumLibrary
    
     *** Variables ***
     ${url}      https://sampleemail.com
     ${browser}      chrome

    *** Keywords ***
      Open my Browser
          Open browser    ${url}     ${browser}
          maximize browser window

      Closing browser
          close all browsers

      Enter username
          BuiltIn.Sleep   3
          
          [Arguments]    ${username}
          input text      name:email    ${username}


      Enter password
          [Arguments]    ${pass}
          input text      name:password    ${password}


      Click login
          click element    xpath://*[@id="root"]/main/div/form/button/span[1]

login_testcase.robot

      *** Settings ***
       Library   SeleniumLibrary
       Resource    ../Resources/login_resources.robot
       Library     DataDriver   ../TestData/sample.xlsx   sheet_name=Sheet1

       Suite Setup       Open my Browser
       Suite Teardown    Closing browser
       Test Template     Login process


       *** Test Cases ***


       Login test    using       ${username}      ${password}


       *** Keywords ***
       Login process
           [Arguments]     ${username}     ${password}
           Enter username     ${username}
           Enter password    ${password}
           Click login        

Source: Python Questions

LEAVE A COMMENT