如何使用Java在Selenium Webdriver的框架集中切换到框架集?

问题描述:

我找到的大多数答案都与切换到框架集中的框架有关. 以下是脚本.

Most of the answers I found were about switching to a frame within a frameset. Following is the Script.

无需切换到frameset.您可以直接切换到frame

There is no need to switching to frameset.. you can directly switch to frame

如果您的frame结构如下所示,请作为图像描述:-

As your image description if your frame structure is like below :-

<frameset>
<frame name = 'frame1'></frame>
<frameset>
<frame name = 'frame2'>
<frame name = 'frame3'>
</frame>
</frame>
</frameset>
</frameset>

,在这里您想切换框架名称frame3 ..您只需切换到该框架,如下所示:-

and here you want to switch frame name frame3.. you just switching to this frame as below :-

driver.switchTo().frame('frame2');
driver.switchTo().frame('frame3');

无需切换frameset

希望它将对您有帮助...:)

Hope it will help you...:)