Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select a frame with no name or id in robot framework?

I need to select a frame but it has no name or id. How do it do it?

<frame src="sampleSrouce" scrolling="yes" frameborder="0" />
<frame src="sampleSource2" scrolling="yes" frameborder="0" />

Thanks!

like image 203
learning_dev_me Avatar asked Nov 13 '15 08:11

learning_dev_me


2 Answers

So basically, I found out that the solution is quite simple. I just used an xpath that points to the second frame:

xpath=/html/frameset/frame[2]

like image 28
learning_dev_me Avatar answered Oct 18 '22 09:10

learning_dev_me


We can get the xpath count, and then get the attribute value of src.

If we get the desired src value we can pick the counter value and create an xpath with index.

Then we can use Select frame with the xpath to select the value.

${count}=    Get Matching Xpath Count    .//div[@dir]/iframe

   :FOR    ${i}    IN RANGE    1    ${count}+1
    \    ${myText}=    Selenium2Library.Get Element Attribute    xpath=//iframe[${i}]@src
    Exit For Loop
Select Frame    xpath=//iframe[2]
Selenium2Library.Input Text    id=text1    test
like image 125
Atishay Avatar answered Oct 18 '22 08:10

Atishay