[Zope3-dev] Using bits and pieces

Stephan Richter srichter at cosmos.phy.tufts.edu
Mon Nov 7 13:52:41 EST 2005


Hi everyone,

I am trying to "mis"-use Selenium components as a simple cross-platform, 
cross-browser blackbox to control aspects of the browser.

Okay here the full scoop. In Zope 3 we recently developed the 
`zope.testbrowser` package, which allows us to write functional tests using a 
Python class that simulates being a browser. Here a small example:

    >>> from zope.testbrowser import Browser
    >>> browser = Browser()
    >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    >>> browser.addHeader('Accept-Language', 'en-US')
    >>> browser.open('http://localhost/@@/testbrowser/simple.html')
    >>> browser.url
    'http://localhost/@@/testbrowser/simple.html'

    >>> browser.open('http://localhost/@@/testbrowser/navigate.html')
    >>> link = browser.getLink('Link Text')
    >>> link
    <Link text='Link Text'
     url='http://localhost/@@/testbrowser/navigate.html?message=By+Link+Text'>
    >>> link.text
    'Link Text'
    >>> link.url # it's normalized
    'http://localhost/@@/testbrowser/navigate.html?message=By+Link+Text'
    >>> link.attrs
    {'href': 'navigate.html?message=By+Link+Text'}
    >>> link.click()
    >>> browser.url
    'http://localhost/@@/testbrowser/navigate.html?message=By+Link+Text'

And this works great and I am very happy with it. However, now I would like to 
develop another backend to the `Browser` class that actually opens a browser 
of my choice and executes the `Browser` classes commands in the actual 
Browser.

Clearly there are several ways to realize this, including DCOP (KDE only), 
PyXPCOM (Mozilla-only) and JSSh (Mozilla-only). However, all of those 
solutions have shortcomings, since they are platform and browser specific.
Since the Zope community has embraced Selenium and several people told me to 
look at selenium as another possibility, I really want to make all of this 
work using Selenium. I have downloaded the SVN version and tried to read some 
of the Javascript, but I am really lost.

I am looking for some hints, guidance, links or whatever to get this started.

Thanks for your help in advance!

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-dev mailing list