19

下面是html代码..

<iframe id="I0_1366100881331" frameborder="0" width="100%">
<div class="ZRa">
<span id="button" class="hAa Qo Bg" tabindex="0" role="button" title="" aria-      label="Click here to publicly +1 this." aria-pressed="false">
</div>
</iframe>    

在上述场景中,我想切换到 IFRAME (iframe id="I0_1366100881331") 以对该 IFRAME 中存在的 SPAN 执行一些操作。我已经尝试过大多数情况,但没有结果:(...请任何人帮忙。

我想要只使用水豚红宝石的黄瓜解决方案..

注意:我尝试使用以下代码但没有结果。

page.driver.browser.switch_to.frame “I0_1366100881331”

4

3 回答 3

33
within_frame(find('<css rule>')) do
  <code for dealing with iframe entries>
end
于 2014-02-27T20:01:36.437 回答
13

我认为您可以尝试使用方法:

within_frame 'id' do
  <code for dealing with iframe entries>
end
于 2013-04-16T10:21:48.377 回答
0

可以有这个代码:

withinframe((:xpath,"//div")) do
#code
end
于 2017-08-23T11:08:04.023 回答