按照HTML,一旦进入 父框架 ,就必须:
- 诱导 WebDriverWait 使 父框架 可用并切换到它。
- 诱导 WebDriverWait 使 子框架 可用并切换到它。
- 您可以使用以下解决方案:
new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@ and @id='documentflowdesk']")));new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath(“//iframe[@class=’GenCss_style-Model’ and contains(@src,’connectionPointId’)]”)));
在这里,您可以找到有关iframe下#document处理方式的相关讨论)



