简体   繁体   English

“查看页面源代码”上的不可见html元素

[英]Invisible html element on “view page source”

I am trying to read an html page in my java code using Jsoup library. 我正在尝试使用Jsoup库读取Java代码中的html页面。 This is the link to the page: http://www.alkhaleej.ae/ 这是页面的链接: http : //www.alkhaleej.ae/

The part in the page that I am interested in is the horizontal menu bar at the top of the page (which has the news categories). 我感兴趣的页面部分是页面顶部的水平菜单栏(具有新闻类别)。 When I right click on that menu bar and choose inspect element, the html elements of interest are visible to me under the tag <div id="MainMenuCenter"> . 当我右键单击该菜单栏并选择inspect元素时,在标签<div id="MainMenuCenter">下可以看到感兴趣的html元素。 However, when I run my code, it turns out this tag is actually empty, and all the children of this tag get invisible. 但是,当我运行代码时,事实证明此标记实际上是空的,并且该标记的所有子代都变得不可见。 I also tried to view the complete document using "view page source" on the webpage. 我还尝试使用网页上的“查看页面源代码”查看完整文档。 I surprisingly found this element empty (no children) as below. 我惊讶地发现此元素为空(无子级),如下所示。

<div id="MainMenuCenter">

</div>

Therefore, I am not able to access the information I need in my code. 因此,我无法访问代码中所需的信息。 What is really going on? 到底是怎么回事? Did the developers hide the children of this element on purpose? 开发人员是否故意隐藏了该元素的子元素? Can you suggest a way to make the children visible to my code? 您能否提出一种使孩子对我的代码可见的方法? Thank you. 谢谢。

You can retrieve the data by looking at the network traffic on 您可以通过查看网络流量来检索数据

Inspect element -> Network 检查元素->网络

Check the traffic one by one or use the find tools. 逐一检查流量或使用查找工具。 If you find the match data, you can re-obtain it by visiting the url who serve the data.. 如果找到匹配数据,则可以通过访问提供数据的网址来重新获取。

Maybe like: http://example.com/serve.php?category=car&page=1 可能像这样: http://example.com/serve.php?category=car&page=1 : http://example.com/serve.php?category=car&page=1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM