0

I have a website where a html tag is nested inside like below. Questions:

  1. How to search for element in frameBody using selenium?
  2. How to wait for element in frameBody successful loaded?

Please help. Thanks. Please get the application source code from this link.

enter image description here

1
  • I tried with this driver.switchTo().frame("frameBody"); but it causes No frame element found by name or id frameBody. Commented Aug 13, 2018 at 5:44

1 Answer 1

1

The <frame> with id = frameBody is nested in another <iframe>, you need to switch to it first

WebElement iframe = driver.findElement(By.cssSelector("#tabFrames > iframe:nth-child(1)"));
driver.switchTo().frame(iframe);
driver.switchTo().frame("frameBody");
Sign up to request clarification or add additional context in comments.

5 Comments

Please see my screenshot of code. Can you pin point me the exact structure?
@peterwkc The structure is very clear, you can see it by the indentations. You can also open and close sections in the developer tools to see it.
It throws NoSuchElementException: no such element: Unable to locate element: tabFrames > iframe:nth-child(2)
@peterwkc It should be driver.findElement(By.cssSelector("#tabFrames > iframe:nth-child(1)"));
I"m using xpath and it works.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.