1

Like the statement,

string value = document.forms["sap.client.SsrClient.form"].elements["sapwdssr..requestCounter"].value;

in javascript, is there a corresponding statement to get the value of a particular input element within a particular form in C#?

I can do so by using HTMLDocument and mshtml interface. But that is a rather cumbersome process so if any direct method or property exists it would be great.

4

1 回答 1

0

我假设您要求解析HTML,而不是尝试对呈现的网页进行某种形式的运行时操作,对吗?

如果是这种情况,我强烈建议您查看HTML Agility Pack,我们已经非常成功地使用它来解析 HTML,就好像它是 XML 一样。您可以使用简单的 XPath 查询来完成您的工作。

于 2011-07-19T12:42:11.347 回答