Robot Framework: How to select an HTML element located inside multiple iframes using Browser lib?

1k views Asked by At

As explained in Browser library, "there is a special selector >>> which can be used to combine a selector for an iframe or frameset and a selector for an element inside a frame", for example:

Click Web Element Is Visible    iframe#iframe-example >>> //a[@onclick='buttonOK();']

The example works fine if I want to select the example button, that is inside "iframe-example". But how can I select an element that is inside multiple iframes/frameset? For example:

frameset >>> frame >>> iframe#iframe-example1 >>> iframe#iframe-example2 >>> //a[@onclick='buttonOK();']

What would be the right structure to select this element?

I tried some structures but the elements were not selected:

Click Web Element Is Visible    frameset >>> frame >>> iframe#iframe-example1 >>> iframe#iframe-example2 >>> //a[@onclick='buttonOK();']
Click Web Element Is Visible    frameset//frame[@id="example"]//iframe[@id="iframe-example1"]//iframe[@id="iframe-example2"]//a[@onclick='buttonOK();']
1

There are 1 answers

0
Deekshith On

Try Select frame keyword

Select frame    //iframe[@id="example1"]
Select frame    //iframe[@id="example2"]
Wait until element is visible     //a[@onclick='buttonOK();']
Click Element    //a[@onclick='buttonOK();']
Unselect frame