Unable to locate the child iframe element which is within the parent iframe through Selenium in Java

牧云@^-^@ 提交于 2019-12-02 02:54:55

As per the HTML once you are on the parent frame you have to:

  • Induce WebDriverWait for the parent frame to be available and switch to it.
  • Induce WebDriverWait for the child frame to be available and switch to it.
  • You can use the following solution:

    new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='gwt-Frame-NavigationComponentViewImplResourcesapplicationFrame' and @id='documentflowdesk']")));
    new WebDriverWait(driver, 10).until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By.xpath("//iframe[@class='GenCss_style-Model' and contains(@src,'connectionPointId')]")));
    

Here you can find a relevant discussion on Ways to deal with #document under iframe

Kamil Khan

Please try below code:

driver.switchTo().frame(driver.findelement(By.xpath(//iframe[@name='documentflowdesk']);

Thread.sleep(5000);

driver.switchTo().frame(driver.findelement(By.xpath(//ifame[@class='GenCss_style-Model']);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!