开发者

fill 2 form one field in common with C#

I need to fill two forms on the same website, my issue is the field because they have the same name, e.g. the password field in both forms is passed, so how can I fill both?

<form  action="post.php" method="post">
  <input type="hidden" name="name" value="value" />
  <input type="text" name="image" />
  <input type="password" name="pass" size="10" tabindex="7" accesskey="Q" value="">
</form>
<form action="post2.php" method="post">
  <input type="hidden" name="name" value="value" />
  <input type="text" name="image" />
  <input type="password" name="pass" size="10" tabindex="4" accesskey="P" value="">
</form>

the c开发者_StackOverflow中文版ode to fill fields I'm using is this: WebBrowser1.Document.GetElementById("pass").SetAttribute("value", stringpassword);

thanks


The id attribute specifies a unique id for an HTML element. The id must be unique within the HTML document. The id attribute can be used by a JavaScript (via the HTML DOM) or by CSS to make changes or style the element with the specified id.

And if your specified website is not following the standard Html practices then you should write your own custom code to access those controls and fill them straight away. You can use Regex Or Xpath for accomplishing this purpose.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜