Re: [pyxpcom] Headless Python Browser?
by Atul Varma other posts by this author
Feb 12 2009 1:53PM messages near this date
view in the new Beta List Site
[pyxpcom] Headless Python Browser?
|
[pyxpcom] Using document from PyShell
Hey Don,
I'm not sure how to do headless browsing the way you're doing it, and I'm
also not sure how possible it is--Mark Finkle told me that doing truly
headless browsing will actually require this bug to be fixed:
https://bugzilla.mozilla.org/show_bug.cgi?id=102699
Unfortunately, it was slated for inclusion in Firefox 3.1 but it still
hasn't been resolved. In the meantime, what we've been doing for Ubiquity
CI has involved setting up Xvfb:
http://en.wikipedia.org/wiki/Xvfb
Hope that helps!
- Atul
On Thu, Feb 12, 2009 at 1:09 PM, Don Spaulding <donspauldingii@[...].com> wrote:
> Hello all,
>
> I'm trying to build an entirely headless web browser. At my job we need
> one for screenscraping, but I'm sure the utility of a headless browser able
> to parse documents *exactly* like a major browser is obvious.
>
> My XPCOM-fu is weak. I'm using the sample layout from the python+xulrunner
> tutorial, but I really want to work from the shell, to start totally
> chromeless. I run into the following issue trying to navigate to a page. I
> assume I'm missing some Vital Initialization Call, but I can't make heads or
> tails out of an Exception so devoid of information.
>
> My code:
>
> # sorry if this is butchered by line breaks
> FLAGS = 0
> from xpcom import components
> browser = components.classes['@
> mozilla.org/embedding/browser/nsWebBrowser;1'].createInstance()<http://mozilla.org/embeddi
ng/browser/nsWebBrowser;1%27%5D.createInstance%28%29>
> browser.queryInterface(components.interfaces.nsIWebNavigation)
> ios = components.classes["@mozilla.org/network/io-service;1
> "].getService(components.interfaces.nsIIOService)
> referrer = ios.newURI('http://blah.com/', None, None)
> browser.loadURI(u'http://google.com/', FLAGS, referrer,None, None)
>
> ---------------------------------------------------------------------------
> Exception Traceback (most recent call last)
>
> /home/don/xulapps/pyxpcom_gui_app/<ipython console> in <module>()
>
> /home/don/xulapps/pyxpcom_gui_app/xulrunner/pylib/xpcom/client/__init__.pyc
> in loadURI(self, Param1, Param2, Param3, Param4, Param5)
>
> Exception: -2147418113 (-2147418113)
>
>
>
> Does anyone know what I'm doing wrong?
>
> Thanks.
> --
> Don Spaulding II
>
>
> _______________________________________________
> pyxpcom mailing list
> pyxpcom@[...].com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
Thread:
Don Spaulding
Atul Varma
|