问题描述
要移回Selenium中的父框架,使用driver.switchTo().parentFrame();
.在我的示例网站中,我还使用driver.switchTo().defaultContent();
实现了相同的功能.
For moving back to parent frame in Selenium,driver.switchTo().parentFrame();
is used. In my example website, I achieved same functionality using driver.switchTo().defaultContent();
also.
这两者之间在功能上有什么区别吗?
Is there any functional difference between these two:
- driver.switchTo().parentFrame();
- driver.switchTo().defaultContent();
在引用HTML文档中的框架时,父框架"和默认内容"是否不同?请解释.
While referring to frames in a HTML document, are "Parent Frame" and "Default Content" different? Please explain.
推荐答案
在一定程度上确实有所不同.假设您有一个页面,其中页面三"在一个框架二"内,而另一帧一"在里面,考虑到您位于框架三"中,这是最里面的...
It does have difference to an extent.Suppose you have a page having frame 'three' inside a frame 'two' inside another frame 'one', considering that you are on the frame 'three' which is inner most...
driver.switchTo().parentFrame();
-这会将焦点移回到帧二".driver.switchTo().defaultContent();
-这会将焦点移回到第一个帧所在的主要(默认)内容.
driver.switchTo().parentFrame();
- This will shift focus back to frame 'two'.driver.switchTo().defaultContent();
- This will shift focus back to main (default) content in which frame 'one' lies.
我希望这会有所帮助.谢谢!
I hope this was helpful. Thanks !
这篇关于返回到Selenium中的父框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!