如何获取浏览器渲染树的序列化(在 C# 中)
我需要一种方法来分析网页及其所有布局相关信息(HTML + 相关 CSS)。 为此,DOM 树是不够的,所以我认为最好的解决方案是分析浏览器渲染树(又名框架树)。
谁能帮助我,我如何才能获得渲染树的序列化?
我想做的分析是在用户界面上有任何可见的变化时得到答案。 渲染树(正如我所读到的)是从 DOM 树中提取出来的浏览器内部树,用于渲染页面。因此不可见的 DOM 元素不是渲染树的一部分。 希望这能让我的问题更清楚......
I need a way to analyse a web page with all its layout relevant information (HTML + relevant CSS).
For this, the DOM Tree is not enough, and so I was thinking that the best solution would be to analyse the browsers rendering tree (aka frame tree).
Can anybody help me, how i possibly could get to a serialisation of the rendering tree?
The analysis I would like to make is to get the answer if anything visible has changed on the user interface.
The rendering tree (as I have read) is the browsers-internal tree that is extracted out from the DOM tree and is used to render the page. So DOM elements that are not visible are not part of the rendering tree.
Hope this makes my questio clearer...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WebKit 的源代码中附带了一个名为 DumpRenderTree 的工具(chrome 也是基于 WebKit 的)。
该工具在控制台上转储网页的渲染树。您可以查看其源代码(主要是 C/C++)并从 C# 调用它,也可以解析控制台的输出。
以下是可能有帮助的代码: https://github.com/WebKit/webkit /tree/master/Tools/DumpRenderTree
There is a tool named DumpRenderTree which comes along with the source code of WebKit (chrome as well as it is based on WebKit).
This tool dumps the render tree of a webpage on console. You can take a look at its source code (mostly C/C++) and call it from C# or you can also parse the console's output.
Here is the code which might help: https://github.com/WebKit/webkit/tree/master/Tools/DumpRenderTree