How to locate a button with xpath

Hi,

I’ve been struggling a couple of days now with this issue.

*** Keywords ***
Open Web Page
    Open Browser     https://empower.me/quiz/start/    Chrome

Answer First Question
   Wait And Click Button    xpath:/html/body/div[1]/div[3]/div/div[4]/div/button[1]

*** Tasks ***
Retrieve Money Personality From Empower
    Open Web Page
    Answer First Question

The robot opens the web page, but then can’t find the element.

Element 'xpath:/html/body/div[1]/div[3]/div/div[4]/div/button[1]' not visible after 5 seconds.

The elements I want to get at is in an iframe and it seems like the whole DOM structure needs to be expanded before I can console that xpath and get the element back.

What I’ve tried:
I included a 20 sec wait.
Wait Until Page Contains Element.
I tried to Wait Until Element Is Visible.
Maybe something to do with Select Frame.

1 Like

Hi,

You are right, there is an iframe that needs to be selected. I managed to
run the example with these additions:

Answer First Question
   Wait Until Element Is Visible  xpath://iframe
   Select Frame  xpath://iframe
   Wait And Click Button    xpath:/html/body/div[1]/div[3]/div/div[4]/div/button[1]
6 Likes

Thanks @MikaK! it worked.

3 Likes