views:

30

answers:

1

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

the code to fill fields I'm using is this: WebBrowser1.Document.GetElementById("pass").SetAttribute("value", stringpassword);

thanks

A: 

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.

Sandeep
<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>
robert
I can't post html code well formattedsorry :(but look the password fieldthere are 2 forms they have the same name fieldslet say I need to fill this fields<input type="password" name="pass" size="10" tabindex="7" accesskey="Q" value="">and<input type="password" name="pass" size="10" tabindex="4" accesskey="P" value="">
robert