Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding elements inside an iframe without a iframe id using robot framework

HTML Looks like this

<iframe src="/apex/cscfga__ConfigureProduct?linkedId=a0W8E000000Lpa5UAC&amp;configId=a0Z8E000000NBGMUA4&amp;retURL=/a0W8E000000Lpa5UAC&amp;isdtp=vw" width="100%" height="100%" onload="hideLoading()" frameborder="0" style="height: 737px;"></iframe>

Select frame doesnt work without id.How should my robot script recognise this iframe(without id)?

My script looks like

${Iframe}=  Execute Javascript  
window.document.getElementsByTagName('iframe')[2]
log ${Iframe}   

But it returns 'None'

Please suggest how do I identify this iframe.

like image 363
DISHA MUNSHI Avatar asked May 06 '26 03:05

DISHA MUNSHI


1 Answers

Select Frame will work with any type of locator. For example, if it's the only iframe on the page you can do this:

select frame    xpath=//iframe

If there are multiple iframes on the page, you need to try to find an ancestor that is uniquely identifiable and then look for the frame relative to that.

For example, given the following html:

<div class="spreadsheet_container">
    <div>
         <iframe ...>

... you can use an xpath such as the following:

select frame    xpath=//div[@class='spreadsheet_container']/div/iframe
like image 107
Bryan Oakley Avatar answered May 07 '26 18:05

Bryan Oakley



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!