从WebBrowser.Document中检索HtmlElement [英] Retrieve an HtmlElement from WebBrowser.Document

查看:97
本文介绍了从WebBrowser.Document中检索HtmlElement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。

我正在处理一个问题,这个问题已经让我头上的每根头发变得灰白......

I'm dealing with an issue that has already grayed every single hair on my head...

在我的应用程序中,我有一个WebBrowser控件。有了它,我就能自动化web登录程序。在一台机器(win7)上,每件事都很好。在另一个(胜利xp),它不...

In my application, I have a WebBrowser control. With it I'm able to automate web loggin procedure. On one machine (win7), every thing is working fine. On another (win xp), its not...

我需要遍历网页中的所有元素。我正在使用以下内容:

I need to traverse over all elements in web page. I'm doing that with the following:

 HtmlElementCollection inputs = currFrame.Document.GetElementsByTagName("img");

在win7机器上,输入中有大约12个元素,我能够找到我需要的元素。

On the win7 machine, inputs has about 12 elements in it and i'm able to find the element i need.

另一方面,在win xp机器上,输入有大约3个元素,没有我感兴趣的元素。这里有什么问题?

On the other hand, on the win xp machine, inputs has about 3 elements without the element i'm interested in. What is wrong here?

我甚至尝试清空缓存,认为它与缓存的元素有关,服务器没有返回,WebBrowser没有加载缓存元素......这没有解决我的问题...为了安全起见,我使用
清除了缓存这个。

I even tried emptying the cache, thought it has to do with elements that are cached are not returned by the server and WebBrowser not loading cached elements... This didnt solve my problem...Just to be on the safe side, i cleared the cache using this.

那么,我怎么能解决这个问题?

So, any ideas of how can i solve this?

谢谢提前...




推荐答案

据我所知,WebBrowser控件在WinXP和更新版本上使用IE7在Windows 7上。您是否尝试在IE中手动打开页面并进入调试模式(通过F12)。你确定这些图像真的存在吗,而且我知道
这听起来很疯狂,用小写字母写成?

As far as I know, WebBrowser control uses IE7 on WinXP and more recent version on the Windows 7. Did you try opening the page manually in the IE and entered debug mode (via F12). Are you sure that the images are really there and that they are, and I know that this sounds crazy, written in lower case?

也许情况很重要。不幸的是,我没有WinXP图像来测试这个说法。

Perhaps case is important. Unfortunately, I do not have WinXP image to test this claim.


这篇关于从WebBrowser.Document中检索HtmlElement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆