如果 selenium webdriver 只有 src 属性,如何让其等待 iframe 完全加载。 我正在尝试创建一个测试用例,其中包含从不同源加载的表单元素的 iframe,在切换到此 iframe 时,此 iframe 的内容不可用,因此测试失败。那么我如何让 Webdriver 等待 iframe 完全加载。
最佳答案
这就是我在代码中的做法:
By by = By.xpath("//iframe[contains(@src,'')]");
try
{
wait.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(by));
//your actions on iframe here
}
关于iframe - 如果 selenium webdriver 仅具有 src 属性,如何让其等待 iframe 完全加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25845636/