0
votes

Below is my code, I could login to the page but after logging in I am not able to log out.

Maximize Browser Window

Input Text    //*[@id="userid"]    some_user_name
Input Password    //*[@id="password"]    some_password 
Click Button    //*[@id="btnSubmit"]
sleep    10s
Select Frame    //*[@id="topFrame"]
Page Should Contain    Log out
Click Element    //*[contains(text(),'Log out')]

Logs:

Starting test: WebScraping.NAS web.Welcome
20191009 15:29:40.801 : INFO : Opening browser 'chrome' to base url 'some url'.
20191009 15:29:45.557 : INFO : Typing text '******' into text field '//*[@id="userid"]'.
20191009 15:29:45.658 : INFO : Typing password into text field '//*[@id="password"]'.
20191009 15:29:45.739 : INFO : Clicking button '//*[@id="btnSubmit"]'.
20191009 15:29:55.823 : INFO : Slept 10 seconds
20191009 15:29:55.881 : INFO : Current page contains text 'Log out'.
20191009 15:29:55.881 : INFO : Clicking element '//*[contains(text(),'Log out')]'.
20191009 15:29:56.310 : FAIL : Element with locator '//*[contains(text(),'Log out')]' not found.
Ending test: WebScraping.NAS web.Welcome
1

1 Answers

0
votes

I think the problem is in the following line:

Select Frame    //*[@id="topFrame"]

The frame tag does not contain the id attribute, instead it uses the name attribute to be identified. (HTML Tag Documentation)

Use @name instead @id, as in the following line

Select Frame    //*[@name="topFrame"]

I hope this solves your problem.