html + javascript automations = [mechanize + ?? ] or something else?

John weekender_ny at yahoo.com
Mon Jan 22 05:47:59 CET 2007



My python2.5 installation on windows did not come with "win32com".
How do I install/get this module for windows?

Thanks,
--j

Duncan Booth wrote:
> "John" <weekender_ny at yahoo.com> wrote:
>
> > Is there a way
> > to control a browser like firefox from python itself? How about IE?
>
> IE is easy enough to control and you have full access to the DOM:
>
> >>> import win32com
> >>> win32com.client.gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-
> 0000C05BAE0B}', 0, 1, 1)
> <module 'win32com.gen_py.EAB22AC0-30C1-11CF-A7EB-0000C05BAE0Bx0x1x1' from
> 'C:\Python25\lib\site-packages\win32com\gen_py\EAB22AC0-30C1-11CF-A7EB-
> 0000C05BAE0Bx0x1x1.py'>
> >>> IE = win32com.client.DispatchEx('InternetExplorer.Application.1')
> >>> dir(IE)
> ['CLSID', 'ClientToWindow', 'ExecWB', 'GetProperty', 'GoBack', 'GoForward',
> 'GoHome', 'GoSearch', 'Navigate', 'Navigate2', 'PutProperty',
> 'QueryStatusWB', 'Quit', 'Refresh', 'Refresh2', 'ShowBrowserBar', 'Stop',
> '_ApplyTypes_', '__call__', '__cmp__', '__doc__', '__getattr__',
> '__init__', '__int__', '__module__', '__repr__', '__setattr__', '__str__',
> '__unicode__', '_get_good_object_', '_get_good_single_object_', '_oleobj_',
> '_prop_map_get_', '_prop_map_put_', 'coclass_clsid']
> >>> IE.Visible=True
> >>> IE.Navigate("http://plone.org")
> >>> while IE.Busy: pass
>
> >>> print IE.Document.getElementById("portlet-news").innerHTML
> <DT class=portletHeader><A class="feedButton link-plain"
> href="feed://plone.org/news/newslisting/RSS"><IMG title="RSS subscription
> feed for news items" alt=RSS src="http://plone.org/rss.gif"> </A><A
> href="http://plone.org/news">News</A> </DT>
>
> ... and so on ...
>
>
> See
> http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/int
> ernetexplorer.asp
> for the documentation.




More information about the Python-list mailing list