1 [[!meta title="Website unittesting with Selenium"]]
2 [[!meta date="2009-10-21 14:00:56"]]
3 I just discovered [Selenium](http://seleniumhq.org/), which allows you
4 to drive browers programmatically. This allows you to test the
5 effects of javascript on the browser's internal page representation.
6 Not very useful for the department website, since we don't use much
7 javascript, but I like its python interface, so I'm replacing my
8 traditional spider with a Selenium implementation.
10 Some bugs I've run into so far:
12 * [start() doesn't take any
13 args](http://jira.openqa.org/browse/SRC-758). Simple fix in
15 * [captureNetworkTraffic("xml") returns requestHeaders as
16 responseHeaders](http://jira.openqa.org/browse/SRC-721). Fixed in
17 source, but you'll need to compile your selenium-server.jar on your
18 own. There's a nice, detailed explaination of building Selenium
19 with [Maven](http://maven.apache.org/)
20 [here](http://wiki.openqa.org/display/SRC/Developer%27s+Guide), but
21 for the impatient, a simple `mvn install` in the svn root directory
23 * [captureNetworkTraffic("xml") captures invalid XML in URL's
24 (ampersand problem)](http://jira.openqa.org/browse/SRC-759).
25 Another simple patch, but this one's just posted by me, so you'll
26 have to apply it by hand and recompile.
27 You get the feeling that people don't use the captureNetworkTraffic
28 side of Selenium very often ;). Ah well, only 3 open bugs in that
29 area left to bump into ;).
31 To keep the test suite easy to maintain, I build it on the fly using
33 generators](http://somethingaboutorange.com/mrl/projects/nose/0.11.1/writing_tests.html#test-generators),
36 More details to come...
39 [[!tag tags/programming]]