Switching to IFrame

I am not looking for generic solution such as switch to some frame by id, name etc..the application I am working on has iframes all over the place and sometimes the element is inside 3 iframes…what I am looking for is some type of logic ¬†that will check :

  1. Is the webelment inside an  iframe ?
  2. If yes, what is the index ?

Example — to click this element I have to go through 2 Iframes

 

driver.switchTo().frame(0);
driver.switchTo().frame(0);

driver.findElement(By.xpath(“//tr[6]/td[3]/div/div/div/div/button[2]”)).click();

 

Thanks

Default Asked on July 20, 2017 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.