Click here to Skip to main content
11,813,557 members (47,242 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: .NET3.5 VS2008 VB .NET , +
the free microsoft word plugin is driving me nuts. Iam trying to fill html forms through using web browser control and GetElementById method.

On blogger home page when i try to login, i have to fill user name, passowrd and then click on submit button. When viewing the HTML source of the page, i get the elements as :

<big></big><h2>Sign in to use Blogger
 with your Google Account</br></h2>
<div class="input-holder"><label for="Email">Username (Email):</label>
<input type="text" size="10" name="Email" id="Email" class="text" dir="ltr" tabindex="1"></input></div>
<div class="input-holder"><label for="Passwd">Password:
(<a href="" title="Forgot your password?">?</a>)</label>
<input type="password" size="10" tabindex="2" name="Passwd" id="Passwd" class="text" autocomplete="off" dir="ltr"></input></div>
<div id="PersistentCookie-holder"><input type="checkbox" name="PersistentCookie" id="PersistentCookie" tabindex="3" value="yes">
<label for="PersistentCookie">Remember me</label>
(<a href="" target="_top" title="What is "remember me"?">?</a>)</input></div>
<div id="signin-btn-holder"><script type="text/javascript">
  document.write("\x3cspan id\x3d\x22signin-btn\x22 class\x3d\x22ubtn\x22 onclick\x3d\x22if (this.className.indexOf(\x26quot;ubtn-disabled\x26quot;) \x3d\x3d -1) {var e \x3d document[\x26#39;login\x26#39;].ok;(e.length) ? e[0].click() :; if (window.event) window.event.cancelBubble \x3d true; return false;}\x22\x3e\x3cspan class\x3d\x22left\x22\x3e\x3cspan\x3e\x26nbsp;\x3cimg src\x3d\x22/img/blank.gif\x22 width\x3d\x221\x22 height\x3d\x221\x22 alt\x3d\x22\x22\x3e\x26nbsp;\x3c/span\x3e\x3c/span\x3e\x3cspan class\x3d\x22i\x22\x3e\x3ca href\x3d\x22javascript:void(0)\x22 tabindex\x3d\x224\x22 onclick\x3d\x22return false;\x22\x3eSign in\x3c/a\x3e\x3c/span\x3e\x3cspan class\x3d\x22right\x22\x3e\x3cspan\x3e\x26nbsp;\x3cimg src\x3d\x22/img/blank.gif\x22 width\x3d\x221\x22 height\x3d\x221\x22 alt\x3d\x22\x22\x3e\x26nbsp;\x3c/span\x3e\x3c/span\x3e\x3c/span\x3e");
<script type="text/javascript">
  document.write("\x3cinput type\x3d\x22submit\x22 id\x3d\x22signin-btn-hidden\x22 name\x3d\x22ok\x22 value\x3d\x22Sign in\x22 tabindex\x3d\x22-1\x22 style\x3d\x22position:absolute; display:block; width:0; padding:0;                z-index:-1; border:none; top:-5000px; left:-5000px\x22\x3e");
<noscript><input type="submit" id="signin-btn-ns" class="ubtn ubtn-inline" name="ok" tabindex="4" value="Sign in"></input></noscript></div>
<div class="r"></div>

so i get the elements by their id and now my code is :

<big>WebBrowser1.Document.GetElementById("Email").SetAttribute("value", "amit.tcet")
            WebBrowser1.Document.GetElementById("Passwd").SetAttribute("value", "151100151105")

but the button is not clicked and hence i cannot login.

any ideas what is wrong?
Posted 19-Jul-10 16:55pm
Edited 19-Jul-10 16:58pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I have done a similar like this here.


or try something like following.

mshtml.HTMLDocument obj;
amitupadhyay007353543543 at 20-Jul-10 3:13am
thanks but since iam using could you tell me, what will be the second line in ?
amitupadhyay007353543543 at 20-Jul-10 3:23am
got it in (directcast), but this is not working. I have been able to automatically fill two other blog sites : and (without mshtml) but blogger doesn't seem to work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Abhinav S 275
1 Palash Mondal_ 190
2 KrunalRohit 150
4 Manas_Kumar 115
0 OriginalGriff 3,877
1 KrunalRohit 2,526
2 Maciej Los 2,245
3 CPallini 2,240
4 ppolymorphe 1,750

Advertise | Privacy | Mobile
Web02 | 2.8.151002.1 | Last Updated 20 Jul 2010
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100