访问HTMLElementCollection时出现问题 [英] Problem Accessing HTMLElementCollection

查看:78
本文介绍了访问HTMLElementCollection时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个C#应用程序来自动输入网页元素

显示在AxWebBrowser控件中。该应用程序在

HTMLDocument的HTMLElementCollection(即HTMLDocument.all)上调用GetEnumerator()来遍历

元素的文档。


当我将应用程序部署到运行Windows XP的客户端系统时,这适用于我的开发系统,包括Debug和Release

版本,

Professional,它不起作用。


我在应用程序中添加了日志,以了解客户端上发生的情况

系统并发现GetType()返回对于所有带有

的元素,'__ComObject''是HTMLBodyClass元素的例外。


我检查了IE设置和我的应用程序使用的DLL的版本在我的
开发系统和客户端系统上,除了

之外,我的开发系统上运行的Microsoft.mshtml位于GAC中,没有任何差异

当它从客户端上的安装目录运行时。


我需要什么为了让客户端安装工作?


谢谢,

Tom

I developed a C# application to automate input to elements of a web page
displayed in an AxWebBrowser control. The app calls GetEnumerator() on the
HTMLDocument''s HTMLElementCollection (i.e. HTMLDocument.all) to walk
elements of the document.

This works perfectly on my development system with both Debug and Release
builds, however, when I deploy the app to a client system running Windows XP
Professional, it doesn''t work.

I added logging to the app to find out what was happening on the client
system and found that GetType() returns ''__ComObject'' for all elements with
the exception of the HTMLBodyClass element.

I have checked IE settings and the versions of the DLLs my app uses on my
development system and the client system and can find no differences except
Microsoft.mshtml running on my development system is located in the GAC
while it is running from my installation directory on the client.

What do I need to do to get the client installation to work?

Thanks,
Tom

推荐答案

汤姆,


你还没有说它在这些其他机器上是如何工作的。


BTW,当您检查

这些对象的类型时,GetType返回正确的类型。这是ToString为System.__ ComObject派生的任何类型返回的内容(当你使用

互操作程序集为MSHTML时,你正在使用它)。 />

你得到的例外有哪些细节?

-

- Nicholas Paldino [.NET / C#MVP] < br $> b $ b - mv*@spam.guard.caspershouse.com


Tom Bean < TB *** @ newsgroup.nospam>在消息中写道

新闻:呃************** @ TK2MSFTNGP10.phx.gbl ...
Tom,

You haven''t said how it doesn''t work on these other machines.

BTW, GetType is returning the correct type when you check the type of
these objects. This is what is returned by ToString for any type deriving
from System.__ComObject (which is what you are using when you use the
interop assemblies for MSHTML).

What are the details of the exception you are getting?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tom Bean" <tb***@newsgroup.nospam> wrote in message
news:uh**************@TK2MSFTNGP10.phx.gbl...
我开发了一个C#应用程序自动输入网页元素
显示在AxWebBrowser控件中。该应用程序在
HTMLDocument的HTMLElementCollection(即HTMLDocument.all)上调用GetEnumerator()来遍历文档的元素。

这在我的开发系统中完美运行然而,当我将应用程序部署到运行Windows
XP Professional的客户端系统时,它都无法正常工作。

我添加了日志记录到应用程序找出客户端系统上发生了什么,发现GetType()为所有元素返回''__ComObject'',但HTMLBodyClass元素除外。

我已经检查了IE设置和我的应用程序在我的开发系统和客户端系统上使用的DLL的版本,并且没有发现差异
除了我的开发系统上运行的Microsoft.mshtml位于

我需要做些什么才能使客户端安装正常工作?

谢谢, Tom
I developed a C# application to automate input to elements of a web page
displayed in an AxWebBrowser control. The app calls GetEnumerator() on the
HTMLDocument''s HTMLElementCollection (i.e. HTMLDocument.all) to walk
elements of the document.

This works perfectly on my development system with both Debug and Release
builds, however, when I deploy the app to a client system running Windows
XP Professional, it doesn''t work.

I added logging to the app to find out what was happening on the client
system and found that GetType() returns ''__ComObject'' for all elements
with the exception of the HTMLBodyClass element.

I have checked IE settings and the versions of the DLLs my app uses on my
development system and the client system and can find no differences
except Microsoft.mshtml running on my development system is located in the
GAC while it is running from my installation directory on the client.

What do I need to do to get the client installation to work?

Thanks,
Tom



Nicholas,


在我的开发系统上,GetType()。Name返回元素的类型,例如,
,HTMLInputElement等。但是在客户端系统上GetType()。名称是

总是__ ComObject。


我没有得到任何异常,但是当我制作比较,如果

(element.GetType()。Name ==" HTMLInputElement"),它总是会失败,因为

" __ ComObject"正在返回作为类型名称。


Tom


" Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com>写在

消息新闻:e3 ************** @ TK2MSFTNGP09.phx.gbl ...
Nicholas,

On my development system, GetType().Name returns the type of the element,
for example, "HTMLInputElement" but on the client systems GetType().Name is
always "__ComObject".

I don''t get any exception but when I make the comparison, if
(element.GetType().Name == "HTMLInputElement"), it always fails because
"__ComObject" is being returned as the type name.

Tom

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:e3**************@TK2MSFTNGP09.phx.gbl...
Tom,
你还没有说它在这些其他机器上是如何工作的。

BTW,当你检查这些类型时,GetType返回了正确的类型对象。这是ToString从System .__ ComObject派生的任何类型返回的内容(这是您在使用
interop程序集进行MSHTML时使用的内容)。

什么是你得到的例外的细节是什么?

-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Tom Bean < TB *** @ newsgroup.nospam>在消息中写道
新闻:呃************** @ TK2MSFTNGP10.phx.gbl ...
Tom,

You haven''t said how it doesn''t work on these other machines.

BTW, GetType is returning the correct type when you check the type of
these objects. This is what is returned by ToString for any type deriving
from System.__ComObject (which is what you are using when you use the
interop assemblies for MSHTML).

What are the details of the exception you are getting?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tom Bean" <tb***@newsgroup.nospam> wrote in message
news:uh**************@TK2MSFTNGP10.phx.gbl...
我开发了一个C#应用程序来自动输入到网页元素
显示在AxWebBrowser控件中。应用程序在HTMLDocument的HTMLElementCollection(即HTMLDocument.all)上调用GetEnumerator()来遍历文档中的元素。

这在我的开发系统中完美运行然而,当我将应用程序部署到运行Windows
XP Professional的客户端系统时,它都无法正常工作。

我添加了日志记录到应用程序找出客户端系统上发生了什么,发现GetType()为所有元素返回''__ComObject'',但HTMLBodyClass元素除外。

我已经检查了IE设置和我的应用程序在我的开发系统和客户端系统上使用的DLL的版本,并且没有发现差异
除了我的开发系统上运行的Microsoft.mshtml位于
GAC从客户端的安装目录运行时。

我需要做些什么才能使客户端安装正常工作?

谢谢, Tom
I developed a C# application to automate input to elements of a web page
displayed in an AxWebBrowser control. The app calls GetEnumerator() on
the HTMLDocument''s HTMLElementCollection (i.e. HTMLDocument.all) to walk
elements of the document.

This works perfectly on my development system with both Debug and Release
builds, however, when I deploy the app to a client system running Windows
XP Professional, it doesn''t work.

I added logging to the app to find out what was happening on the client
system and found that GetType() returns ''__ComObject'' for all elements
with the exception of the HTMLBodyClass element.

I have checked IE settings and the versions of the DLLs my app uses on my
development system and the client system and can find no differences
except Microsoft.mshtml running on my development system is located in
the GAC while it is running from my installation directory on the client.

What do I need to do to get the client installation to work?

Thanks,
Tom




Tom,


你有没有分发您正在使用互操作库来获取HTML文档模型吗?

-

- Nicholas Paldino [.NET / C#MVP ]

- mv*@spam.guard.caspershouse.com

Tom Bean < TB *** @ newsgroup.nospam>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP12.phx.gbl ...
Tom,

Have you distributed the interop libraries as well that you are using to
access the HTML document model?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tom Bean" <tb***@newsgroup.nospam> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nicholas,

在我的开发系统上,GetType()。Name返回元素的类型,例如,HTMLInputElement等。但是在客户端系统上GetType()。名称
始终是__ ComObject。

我没有任何异常但是当我进行比较时,如果
( element.GetType()。Name ==" HTMLInputElement"),它总是失败,因为
" __ ComObject"正在返回作为类型名称。

Tom

Nicholas Paldino [.NET / C#MVP]" < mv*@spam.guard.caspershouse.com>在消息新闻中写道
:e3 ************** @ TK2MSFTNGP09.phx.gbl ...
Nicholas,

On my development system, GetType().Name returns the type of the element,
for example, "HTMLInputElement" but on the client systems GetType().Name
is always "__ComObject".

I don''t get any exception but when I make the comparison, if
(element.GetType().Name == "HTMLInputElement"), it always fails because
"__ComObject" is being returned as the type name.

Tom

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote
in message news:e3**************@TK2MSFTNGP09.phx.gbl...
Tom,
你还没有说它在这些其他机器上是如何工作的。

BTW,当你检查这些物体的类型时,GetType会返回正确的类型。这是ToString为从System .__ ComObject派生的任何类型返回的内容(这是你在使用MSHTML的互操作程序集时使用的内容)。

什么是你得到的例外的细节是什么?

-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com

Tom Bean < TB *** @ newsgroup.nospam>在消息中写道
新闻:呃************** @ TK2MSFTNGP10.phx.gbl ...
Tom,

You haven''t said how it doesn''t work on these other machines.

BTW, GetType is returning the correct type when you check the type of
these objects. This is what is returned by ToString for any type
deriving from System.__ComObject (which is what you are using when you
use the interop assemblies for MSHTML).

What are the details of the exception you are getting?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tom Bean" <tb***@newsgroup.nospam> wrote in message
news:uh**************@TK2MSFTNGP10.phx.gbl...
我开发了一个C#应用程序来自动输入到网页元素
显示在AxWebBrowser控件中。应用程序在HTMLDocument的HTMLElementCollection(即HTMLDocument.all)上调用GetEnumerator()来遍历文档中的元素。

这在我的开发系统中完美运行然而,当我将应用程序部署到运行Windows XP Professional的客户端系统时,它都无法运行。

我添加了日志记录到应用程序找出客户端系统上发生了什么,发现GetType()为所有元素返回''__ComObject'',但HTMLBodyClass元素除外。

我已经检查了IE设置和我的应用程序在我的开发系统和客户端系统上使用的DLL的版本,并且没有发现差异
除了我的开发系统上运行的Microsoft.mshtml位于
GAC从
客户端上的安装目录运行时。

我需要做些什么才能使客户端安装正常工作?

谢谢,
Tom
I developed a C# application to automate input to elements of a web page
displayed in an AxWebBrowser control. The app calls GetEnumerator() on
the HTMLDocument''s HTMLElementCollection (i.e. HTMLDocument.all) to walk
elements of the document.

This works perfectly on my development system with both Debug and
Release builds, however, when I deploy the app to a client system
running Windows XP Professional, it doesn''t work.

I added logging to the app to find out what was happening on the client
system and found that GetType() returns ''__ComObject'' for all elements
with the exception of the HTMLBodyClass element.

I have checked IE settings and the versions of the DLLs my app uses on
my development system and the client system and can find no differences
except Microsoft.mshtml running on my development system is located in
the GAC while it is running from my installation directory on the
client.

What do I need to do to get the client installation to work?

Thanks,
Tom





这篇关于访问HTMLElementCollection时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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