Jsoup解析iframe里面內容


使用Jsoup解析iframe時候,不能直接拿到里面內容,例如下面結構的iframe。

<iframe id="myframe" height="100%" width="100%" frameborder="0" src="TestReport.html" style="height: 177px;"></iframe>

解決辦法如下:

提取iframe中src地址,然后直接請求這個地址內容即可。

    Document doc = Jsoup.connect("http://ycyzharry/jenkins/view/TestReport.html").timeout(10000).get();
    Elements content = doc.getElementsByClass("summary");
    String linkText = content.text();
    String[] b = linkText.split(",");
    System.out.println(b[2]);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM