Search code examples
authenticationrobotframeworkselenium2library

How to switch to a new "Login dialog" in browser via Selenium2Library?


I have to automate a login test using RobotFramework (python-backed) and the selenium2Library.

The login page uses a Login Dialog box with two fields. I cannot seem to be able to set a RobotFramework script to get the text into the appropriate text boxes within the loginDialog however.

Any help is greatly appreciated. This is what I am trying to get to.

This is what I am working with for now. Any help is much appreciated.

Thanks!


Solution

  • You can include the username and password as part of the url.

    For example:

    *** Settings ***
    Library  Selenium2Library
    
    Suite Teardown  Close all browsers
    Suite Setup     Open browser  about:blank  ${BROWSER}
    
    *** Variables ***
    ${BROWSER}   chrome
    ${USERNAME}  admin
    ${PASSWORD}  admin
    
    *** Test Cases ***
    Basic authorization
        go to  https://${username}:${password}@the-internet.herokuapp.com/basic_auth
        page should contain  Congratulations! You must have the proper credentials.