[Baypiggies] headless javascript execution

Benjamin Sergeant bsergean at gmail.com
Fri Jan 9 21:46:10 CET 2009

On Fri, Jan 9, 2009 at 9:18 AM, Nathan Ramella <nar at hush.com> wrote:

> Hi guys,
> Last night was my first meeting and I wanted to thank everyone involved for
> organizing, as well as both of the speakers -- I learned new things and have
> some things I need to research.
> There were a couple of things I wanted to throw out there since people seem
> to be interested (I apologize if you've covered them before, but nobody that
> I heard brought them up at the meeting in context)
> * jsbridge, which I've used in the past with success, I'm behind on its
> latest versions but it does provide a fairly nifty interface ipython style,
> allows you to tab complete and whatnot. It's easy_install-able. Good for
> interactive mucking around.
> http://code.google.com/p/jsbridge/
> * Mozrepl, which isn't Python specific, it's basically a telnet socket
> interface that you can get a javascript console out of -- might be useful if
> you've got some specific task in mind that jsbridge doesn't cover. Also good
> for interactive mucking around.
> http://wiki.github.com/bard/mozrepl/home
> * python-spidermonkey looks like it's back in development with checkins as
> recently as October, if you need something that's completely separate from a
> browser (unit tests, regression, build verification..)
> http://code.google.com/p/python-spidermonkey/

Lot of good links. Thanks.

I was amazed by the selenium demo and just tried it. Doesn't quite work for
I downloaded the firefox remote controll, which consist of some java code
and some sdk for various langages.
I started the java server. (first I add to create a symlink from
/path/to/my/firefox/binary to /usr/bin/firefox-bin)

 [bsergean at localhost selenium-server-1.0-beta-1]$ java -jar
12:38:21.688 INFO - Java: Sun Microsystems Inc. 1.6.0_0-b11
12:38:21.689 INFO - OS: Linux amd64
12:38:21.691 INFO - v1.0-beta-1 [2201], with Core v1.0-beta-1 [1994]
12:38:21.773 INFO - Version Jetty/5.1.x
12:38:21.774 INFO - Started
12:38:21.775 INFO - Started HttpContext[/selenium-server,/selenium-server]
12:38:21.775 INFO - Started HttpContext[/,/]
12:38:21.780 INFO - Started SocketListener on
12:38:21.781 INFO - Started org.mortbay.jetty.Server at 22998b08

Then I try some python client code.
[bsergean at localhost selenium-python-client-driver-1.0-beta-1]$ python
... stuck ...

On the server side:
12:38:47.234 INFO - Checking Resource aliases
12:38:47.236 INFO - Command request: getNewBrowserSession[*firefox,
http://www.google.com/webhp/] on session null
12:38:47.236 INFO - creating new remote session
12:38:47.330 INFO - Allocated session a4d85344a2ac457994383bcf26407b1c for
http://www.google.com/webhp/, launching...
12:38:47.380 INFO - Preparing Firefox profile...

....It takes a long time to prepare this firefox profile.

> In relation to the coverage talk, I immediately thought of Snakefood, which
> isn't about code coverage at all, but instead dependency graphing.
> http://furius.ca/snakefood/

I just give it a try and it looks pretty usefull, especially for building
virtualenv or for packaging.

$ sfood scene.py
(('/home/bsergean/src/pyview', 'scene.py'), (None, None))
(('/home/bsergean/src/pyview', 'scene.py'), ('/home/bsergean/src/pyview',
(('/home/bsergean/src/pyview', 'scene.py'), ('/home/bsergean/src/pyview',
(('/home/bsergean/src/pyview', 'scene.py'), ('/home/bsergean/src/pyview',
(('/home/bsergean/src/pyview', 'scene.py'), ('/home/bsergean/src/pyview',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib/python2.5', 'sys'))
(('/home/bsergean/src/pyview', 'scene.py'),
('/usr/lib/python2.5/site-packages', 'psyco'))
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'), ('/usr/lib64/python2.5',
(('/home/bsergean/src/pyview', 'scene.py'),
('/usr/lib64/python2.5/lib-dynload', 'bz2.so'))
(('/home/bsergean/src/pyview', 'scene.py'),
('/usr/lib64/python2.5/lib-dynload', 'time.so'))
(('/home/bsergean/src/pyview', 'scene.py'),
('/usr/lib64/python2.5/lib-dynload', 'zlib.so'))
(('/home/bsergean/src/pyview', 'scene.py'),
('/usr/lib64/python2.5/site-packages', 'pylzma.so'))

$ sfood scene.py | sfood-copy /tmp/foobar
$ ls /tmp/foobar/
bz2.so   logging  math_utils.py  os.py   platform.py  pylzma.so
serialisation.py  time.so    utils.py
copy.py  log.py   optparse.py    pdb.py  psyco        scene.py
struct.py         urllib.py  zlib.so

Thanks for the link.

For something a bit related, you can use pyreverse (integrated in pylint) to
create an UML diagram out of your python code.

- Benjamin

> Thats it for now. If there's any OSX-using baypiggies out there I've got a
> silly project that I'm getting ready to release involving
> DictionaryServices.framework and could use some beta-testers. If you like
> the Oxford English Dictionary and want access to it via Python, shoot me an
> email and I'll send you a tarball to try out.
> -Nathan Ramella
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20090109/25d9d295/attachment-0001.htm>

More information about the Baypiggies mailing list