//In C#
driver.switchTo().Frame("FirstFrameFound");
//To close the box again and get back to the overall main box.
driver.switchTo().defaultContent();
如果你的第二帧是第一帧的子帧,你必须跳入第一帧,然后切换到第二帧,与内部元素交互。
//In C#
//Switch to the first frame
driver.switchTo().Frame("FirstFrameFound");
//Switch to the second frame
driver.SwitchTo().Frame("SecondFrame");
//Now look for your element that you wish to interact with.
driver.FindElement(By.XPath("//html/body/div[11]"));
//To close the box again and get back to the overall main box.
driver.switchTo().defaultContent();