首页 > 解决方案 > 无法在 div 中切换到 iframe

问题描述

我是 Python 新手。我正在尝试切换到div (arvfframe) 内的 iframe。我用谷歌搜索了如何切换到单独的 iframe 并且可以做到。但这是 div 中的 iframe(请参阅 html 了解详细信息)。

<div id="WIN_1_304273010" arid="304273010" artype="Display" ardbn="z2DVF_QuestionHolder" arcontainerid="304272670" arpercentwidth="100" arpercentheight="100" class="arfid304273010 ardbnz2DVF_QuestionHolder" style="top: auto; left: auto; width: 780px; height: 445px; z-index: 1046; background-color: transparent; min-width: 20px; max-width: 32767px; min-height: 20px; max-height: 32767px; position: relative; overflow: hidden;" arvfframe="<iframe style=&quot;top:0px&amp;#59; left:0px&amp;#59; width:782px&amp;#59; height:438px&amp;#59;background-color: transparent&amp;#59;&quot; name=&quot;VF304273010&quot; frameborder=0 scrolling=&quot;auto&quot; allowtransparency=&quot;true&quot; arviewbordercolor=&quot;null&quot; title=&quot;Question Holder&quot; src=&quot;javascript:&amp;quot;&amp;lt;HTML&amp;gt;&amp;lt;/HTML&amp;gt;&amp;quot;&quot; onload=&quot;DVFol&amp;#40;&amp;#41;&quot;>
</iframe>" arwindowid="1" arstop="0">

切换到没有 div 的 iframe 更容易(我还附上了 html)。但它是一个动态 iframe,每次重新加载页面时 ID 都会更改,因此我无法通过 ID 获取元素。如果您能建议如何处理动态 iframe,我会非常感激。

    <iframe style="top:0px; left:0px; width:100%; height:100%;background-color: transparent;" name="VF304273010_1633252952042IF_1" id="VF304273010_1633252952042IF_1" frameborder="0" scrolling="auto" allowtransparency="true" arviewbordercolor="null" title="Question Holder" src="javascript:&quot;<HTML></HTML>&quot;" onload="F(1,304273010).ol()">
    </iframe>
    </div>

标签: pythoniframedynamic

解决方案


推荐阅读