user2323331 user2323331 - 1 year ago 264
Java Question

Traverse Iframe using jsoup

I have html structure like this. I want to get the second table that has no class or id. How would I get the second table from the



I am trying like this

Elements iframe ="iframe");

for(Element e : iframe) {

Can anyone help me?

Answer Source

Do you want to traverse the iframe element? It is better to get the content from iframe source like

Element iframe ="iframe").first();
String iframeSrc = iframe.attr("src");

if(iframeSrc != null) {
    iframeContentDoc = Jsoup.connect(iframeSrc).get();

You can do this way only.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download