jeudi 5 juillet 2018

Robot Framework - Focus/Select DropDown popup window

I have a requirement to write a UI test using Robot Framework. I am simulating user login in this website https://www.cosmote.gr/hub/ (select English on the top right of the webpage). User should click on Login/Register and a popup window appears:

popup window

I am trying now to add input text in email text field and password field and then press the button to login. Since I am new to Robot Framework, I am not aware how to focus in the popup window and therefore my test fails - it cannot find the text field in the popup window.

login example

My code is:

    *** Settings ***
Documentation    Present some information about this test suite
Library  Selenium2Library

*** Variables ***
${Browser} =  ff
${HOME_PAGE} =  https://www.cosmote.gr/hub/
${BUTTON_LOGIN} =  //*[@id="wcs_header"]/div[5]/div[1]/div[2]/div/div
${VALID_USERNAME} =  
${VALID_PASSWORD} =  
${PAGE_CONTAINS} =  My COSMOTE
${USERNAME_FIELD} =  //*[@id="loginIn"]
${PASSWORD_FIELD} =  //*[@id="pwdIn"]
${SUBMIT_BUTTON} =  //*[@id="loginBtnIn"]
${POPUP} =  //*[@id="cosid_md_login"]/div[2]
${FRAME} =  idmframeIn

*** Test Cases ***
User Login With Valid Credentials
    [Tags]  Login
    Open Browser  ${HOME_PAGE}  ${Browser}
    Wait Until Element Is Visible  ${BUTTON_LOGIN}
    Click Element  ${BUTTON_LOGIN}
    Wait Until Page Contains  ${PAGE_CONTAINS}
    Select Frame  id=${FRAME}
    Input text  ${USERNAME_FIELD}  ${VALID_USERNAME}
    Input password  ${PASSWORD_FIELD}  ${VALID_PASSWORD}
    Click Element  ${SUBMIT_BUTTON}
    Wait Until Page Contains  Hello
    Close Browser

How can I focus/select the popup window in order to be able to find the text fields and the login button?

Thanks in advance for your help!

Aucun commentaire:

Enregistrer un commentaire