On Apr 15, 2:16 am, "Brett Morgan" <
brett.mor...@gmail.com> wrote:
> > Selenium-IDE can exporttestscripts into Python unittestform. But
> > those tests try to "import selenium", which fails, and I have yet to
> > locate the selenium module anywhere on the web. Still looking.
>
> Ahh. Mmm. Tried selium mailing lists?
Good point. I did finally find it. I was looking in the wrong place.
It was bundled with Selenium-RC which runs as a service. The Python
module is meant to run with that.
So for the record, I was able to run the selenium-RC server on my Mac
and direct it to drive my AppEngine website by way of Firefox. RC is
not limited to only Firefox, but that's all I tested.
It was a little confusing since I wasn't already familiar with how the
selenium system was supposed to work. Here's what I figured out:
The Python Selenium test scripts are -not- run within the AppEngine,
nor do they need to be. The Selenium-RC server is a (Java based)
server that acts as a proxy of sorts. Your Python test script (located
in your local environment, not in the app engine directory) can
control the selenium java server which then controls your browser
which then drives your website. That website-under-test can be
anywhere locally, in the Google app engine, or on the internet.
In my case, both the Selenium server and Google App Engine were
serving on my localhost. Since they are on different ports (by
default), they don't conflict at all. Python connects to the selenium
port and selenium drives firefox to the AppEngine port.
A nice bonus is you can use Selenium-IDE GUI to create your tests in
Selenium native format initially, if you want. It has an export
feature that can convert it and save in Python form. They -almost-
work immediately. I couldn't figure out how to set the $baseURL
variable, so I manually edited the Python export template (Options-
>Options...->Formats). I also added a #!/usr/bin/python at the top.
Having the template right is valuable since it is overwritten evertime
you export an update.
My unit tests work! I am looking forward to tweaking in Python from
now on. Flow control within Selenium is frustratingly primitive.