win32com and internet explorer

Jose Correia correia_j at hotmail.com
Wed Jul 10 11:58:47 EDT 2002


Hi,

You're very close.

> doc = ie.Document
> doc.forms(0).uf.value = "username" #from name = "uf" refer HTML above
> time.sleep(1)
> doc.tcforms.gf.value = "Password"    #from name = "gf" refer HTML
          ^^^^^^^
This is wrong.  This line should read:
doc.forms(0).gf.value = "Password"

Both the uf and gf fields are on the same unnamed form (form 0)
I tried the above on my side and it works. (Don't forget the submit() )

TIP: If you set ie.Visible=1 you can toggle to the browser and watch the
text being entered into the fields by your program.  (set your sleep between
commands to 5 seconds, say, and watch the browser window). This is great for
debugging and initial experimentation.

> P.S , what does HTH mean?
HTH = Hope That Helps.   :-)

> Also, the links to MSDN give me 404 error...
Unfortunately the message breaks the URL into 2 lines due to the length of
the URL so you can't just click on it.
Cut and paste the first line into the browser, then cut and paste the 2nd
line onto the end of it, then try nav to it.  Make sure there is no
line-feed character between the pastes.
Both links work on my side.  Here they are again:

Link 1 (both lines):
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/
reference/objects/obj_document.asp

Link 2 (both lines):
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/
webbrowser/reference/ifaces/IWebBrowser2/IWebBrowser2.asp


HTH,  :-)

Jose






More information about the Python-list mailing list