使用机器人框架在没有 iframe id 的 iframe 中查找元素
Finding elements inside an iframe without a iframe id using robot framework
HTML 看起来像这样
<iframe src="/apex/cscfga__ConfigureProduct?linkedId=a0W8E000000Lpa5UAC&configId=a0Z8E000000NBGMUA4&retURL=/a0W8E000000Lpa5UAC&isdtp=vw" width="100%" height="100%" onload="hideLoading()" frameborder="0" style="height: 737px;"></iframe>
Select 框架在没有 id.How 的情况下无法工作 我的机器人脚本应该识别这个 iframe(没有 ID)吗?
我的脚本看起来像
${Iframe}= Execute Javascript
window.document.getElementsByTagName('iframe')[2]
log ${Iframe}
但是returns'None'
请建议我如何识别此 iframe。
Select Frame
适用于任何类型的定位器。例如,如果它是页面上唯一的 iframe,您可以这样做:
select frame xpath=//iframe
如果页面上有多个iframe,您需要尝试找到一个唯一可识别的祖先,然后寻找相对于它的框架。
例如,给定以下 html:
<div class="spreadsheet_container">
<div>
<iframe ...>
...您可以使用如下所示的 xpath:
select frame xpath=//div[@class='spreadsheet_container']/div/iframe
HTML 看起来像这样
<iframe src="/apex/cscfga__ConfigureProduct?linkedId=a0W8E000000Lpa5UAC&configId=a0Z8E000000NBGMUA4&retURL=/a0W8E000000Lpa5UAC&isdtp=vw" width="100%" height="100%" onload="hideLoading()" frameborder="0" style="height: 737px;"></iframe>
Select 框架在没有 id.How 的情况下无法工作 我的机器人脚本应该识别这个 iframe(没有 ID)吗?
我的脚本看起来像
${Iframe}= Execute Javascript
window.document.getElementsByTagName('iframe')[2]
log ${Iframe}
但是returns'None'
请建议我如何识别此 iframe。
Select Frame
适用于任何类型的定位器。例如,如果它是页面上唯一的 iframe,您可以这样做:
select frame xpath=//iframe
如果页面上有多个iframe,您需要尝试找到一个唯一可识别的祖先,然后寻找相对于它的框架。
例如,给定以下 html:
<div class="spreadsheet_container">
<div>
<iframe ...>
...您可以使用如下所示的 xpath:
select frame xpath=//div[@class='spreadsheet_container']/div/iframe