如何使用 C# 获取 HTML 元素坐标?
这里给出的答案非常好。然而,如果您试图从自己的蜘蛛中处理大量信息,那么打开 Internet Explorer 的完整实例似乎有些矫枉过正。
有没有人找到/遇到/想到一种方法来使用 IE 的底层接口结构来做到这一点(例如 IHTMLDocument2 及其兄弟)。
提前致谢。
This is related to (How to get HTML element coordinates using C#?)
The answer given here is quite good. However, opening up a full instance of Internet Explorer seems like overkill if you're trying to process a good deal of information from within your own spider.
Has anyone found/encountered/thought of a way to to do this using the underlying interface structures of IE (Like IHTMLDocument2 and it's brethren).
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大多数浏览器并不在每种情况下都同意按像素渲染。 CSS 合规性、圆角、透明度支持和填充错误(我正在看着你,IE6)只是其中的一些。
可靠地做到这一点的唯一方法是打开一个像您链接的问题一样的浏览器并以这种方式找出答案。即使如此,也要知道您的结果可能与其他浏览器看到的结果不同。
站点说明:不同的 DPI 和 DPI可访问性的缩放设置也会影响这一点,人们看到的内容有很多变量。 Mac 字体渲染也有所不同,因此这些用户通常会看到略有不同的内容。
Most browsers don't agree on per-pixel rendering in every situation. CSS Compliance, rounded corners, transparency support and padding bugs (I'm looking at you, IE6) are just a few.
The only way to reliably do this is to open a browser like the question you linked and figure it out that way. Even then, know that your results may not be the same as another browser will see it.
Site note: Different DPI & zoom settings for accessibility also will affect this, there are tons of variables in what people see. Mac font rendering also differs, so those users will usually see things slightly different as well.