elliot's blog

Dealing with self-signed SSL certificates when running Selenium server with Firefox

Selenium is a decent tool for testing web UIs, with good integration with a variety of languages. We use it on Talis Prism for testing the UI, running a Selenium server instance then firing Ruby rspec tests and an older HTML suite at it. Here's the part of the Ant build script which runs the HTML suite using Selenium :

<target name="prism-selenium-tests" description="Run the old Prism Selenium tests">
  <echo message="Running old Selenium tests against Prism" />
  <java jar="test/dependencies/Selenium/selenium-server.jar" fork="true" maxmemory="1024m">
    <arg line="-debug -timeout 500 -htmlSuite '*chrome ${firefox.bin}' http://${prism.host} \
       test/selenium/testSuite.html doc/seleniumResults.html" />
  </java>
</target>

where the variables we interpose are:

${firefox.bin} = path to the Firefox binary to use
${prism.host} = HTTP host to run the tests against

This works without a hitch if you're not using HTTPS; but as soon as your tests redirect to an HTTPS URL on the same host (we serve parts of Prism over SSL), where your SSL certificate is self-signed, things go wrong. As Selenium effectively runs Firefox with a new profile every time, you potentially lose any certificate exceptions you might accept.

One technique we were using was to create a custom profile; run Firefox using that profile; browse to the HTTPS URL and accept the exception into that profile; then close the profile.

This kind of worked, but we still got odd popups from Firefox about new extensions being installed. Just annoying.

I think I've now worked out the solution, which was largely based on http://kapanka.com/2008/12/selenium-rc-firefox-and-the-self-signed-ssl-c.... It's a bit of a pain in the arse, but it does seem to work. Here goes.

  1. Close down any running Firefox instances.
  2. Start Firefox (the one you're going to run your tests with) with the profile manager: firefox -ProfileManager
  3. Create a new profile. You'll be prompted to choose a directory for the profile. Put it somewhere inside the project where you're writing the tests.
  4. Select the profile and run Firefox using it.
  5. Browse to the HTTPS URL (with self-signed certificate) you're going to be testing against.
  6. Accept the self-signed certificate when prompted. This creates an exception for it in the profile.
  7. Close the browser.
  8. Go to the Firefox profile directory.
  9. Delete everything in the directory except for the cert_override.txt and cert8.db files.
  10. When you run your Selenium server (like in my Ant example above), pass a -firefoxProfileTemplate /path/to/profile/dir argument to it. This tells Selenium to use your partial profile (with certificate exceptions) as a basis for minting its new profile. So you get the certificate exceptions, but without any of the other clutter you would get if you used a whole profile.

The Ant task above, with this option, looks like this:

<target name="prism-selenium-tests" description="Run the old Prism Selenium tests">
  <echo message="Running old Selenium tests against Prism" />
  <java jar="test/dependencies/Selenium/selenium-server.jar" fork="true" maxmemory="1024m">
    <arg line="-debug -timeout 500 -firefoxProfileTemplate test/firefoxProfile \
       -htmlSuite '*chrome ${firefox.bin}' http://${prism.host} test/selenium/testSuite.html doc/seleniumResults.html" />
  </java>
</target>

Outside of Ant, the command might look something like:

java -jar test/dependencies/Selenium/selenium-server.jar -firefoxProfileTemplate /path/to/profile \
-htmlSuite '*chrome firefox-bin' http://host.com testSuite.html seleniumResults.html

Works for me.

Citations

Skype on Ubuntu Intrepid Ibex 8.10

I upgraded my laptop just before Christmas, but unfortunately couldn't get Skype working easily.

First off, I tried the packages for Ubuntu provided by Skype, but I couldn't get them to work. Instead, I used the Medibuntu Skype package. To use these, you just add a couple of repositories to your apt sources: see this page for details.

These worked, kind of: Skype started, but the audio capture didn't work. I found this article, which suggests a fix, by turning off pulseaudio (the default, poorly-configured sound server for Intrepid).

But this didn't seem to completely solve my issues, as Skype kept hanging when you tried to close it down.

So, instead, I followed these longer but more comprehensive instructions, which leave pulseaudio turned on, but fix its configuration. They seem to have done the trick.

Christmas 2008

Great Christmas holiday. Shame it's over.

Enjoyed watching lots of films through Sky+. Jonathon Creek, Gavin and Stacey, and Wallace and Gromit were good. Got the broadband working (though Sky's DNS servers are knackered at the moment).

Joel started eating solid food: he's starting to get the hang of it. Chloe and Ian came for Christmas day and we spent most of the time playing on the Wii and eating.

Presents I got:

  1. Mario Karts Wii plus extra steering wheel
  2. Made to Stick book
  3. Everything is Miscellaneous book
  4. Hello Young Lovers by Sparks
  5. Missiles by The Dears
  6. The Thirteenth Floor DVD
  7. Hot Shots (I and II) DVD
  8. The Apple Source Book
  9. A garden fork
  10. A bag for holding string
  11. A puzzle book (I realised I love puzzles while on holiday)
  12. A planetarium
  13. Spy pens
  14. Shut the Box game

Back to work Monday. Also need to stop eating so much crap, as I think I've put a few pounds on over Christmas.

And yes, Happy New Year and all that.

Tesco and Amazon mp3 download services

Not sure how long these have been around, but Tesco and Amazon now both have mp3 download services.

Tesco's site is abysmal. So slow as to be unusable, particularly when you're doing a search; has a weird tilting album cover browser; and an over-reliance on Javascript for what should be simple links (note to web developers: if you're fetching a new page of results, use a frigging link, not Javascript). 77p per track is too much (compare with eMusic's 16p per track, albeit for stuff most people don't want to buy). All in all, a disaster.

Amazon's is far, far better. But the issue here is the price: it's still TOO EXPENSIVE (unless you're buying really common chart stuff, when it might be cheaper). For most things, it's 79p per track. It doesn't take a genius to work out that if I can buy The Early Years by Roxy Music for £6.98 on CD, or download it as mp3s FOR THE SAME PRICE, I'm going to buy the CD and wait two days for it to arrive. I'd rather have the physical object, thanks very much. How complicated is it to work this out? If the mp3s were around £3, I'd have bought them: immediacy + lower price - transience of medium > possession of the physical object - higher price - 2 days waiting.

Of course, the temptation is always there to skulk around bittorrent sites looking for it. Bear in mind I already own all the tracks on that CD, across all the early Roxy Music albums. I resent having to pay at all: I've already paid once. Don't get me started.

Time, like an ever flowing stream

Seems to be passing more and more quickly.

We got Sky+ last weekend. The best thing about it for me, at the moment, is that it's great being able to watch a different comedy film every night. I am still in the "bewildered by choice" phase of engagement, but gradually working out where stuff is.

I feel quite unprepared for Christmas. I've done most (all?) of my shopping, but I need an audit to decide whether I need to get more stuff.

Joel is getting to the point where he recognises me when I come home, and he's all smiles. Lovely. Makes up for him waking up at 5.30 some mornings: after which he ends up on the lying on bathroom floor while I'm having a shower, so Nicola can get some rest. He goes onto solid food next week, having breakfast with me and Madeleine.

Madeleine is getting on well with her reading (can read most short words), likes doing number squares and crosswords, still does drawing every morning when she gets up. She's growing up fast. For her birthday she got several games, so we've been playing Junior Monopoly a few times.

I haven't been doing much. I've played with Google App Engine a couple of evenings, but apart from that, haven't been coding outside work. Too tired. Went to see John Shuttleworth live at the weekend: well worth seeing.

Another year nearly over. Personal achievements have been thin on the ground (far fewer extra-curricular activities). I've read about the same number of books I do every year; still not managed my goal of one per week. 35 to be precise. Here's the list:

Remember this?

gopher://gopher.floodgap.com/1/new (your browser, if it's not Firefox, might not know what to do with this)

I was there.

In a self-referential response to myself

Paul responded in a comment to this post. He pointed out that the small thing we may have lost (the ability to concentrate hard on "slow" pleasures) is more than compensated for by what we've gained: almost unlimited horizons, the wealth of the world at our fingertips, i.e. the internet. He's right. I was just being an old curmudgeon. Must have been a downer of a day.

Started using Twitter

I started using Twitter last week. Mainly peer pressure, but also as an experiment. Call me a member of "the early majority".

That's not the point of this blog entry though. Here's the point. Coming right up.

I use Google Reader, which is good; but it can't read Twitter feeds, as they require authentication. So I used FreeMyFeed, to which you give your Twitter username, password and friend feed URI. In return it creates an alternative, non-authenticated feed with the content of your original feed. Which you can get at with Google Reader.

There's the point. FreeMyFeed: useful.

Have we lost something?

Last night I watched The Rolf Harris Show (the link is to the episode on iPlayer), originally broadcast in 1969. I've always been a bit of a fan of Rolf (mainly because of his Cartoon Time series when I was growing up), but I hadn't seen his variety show before.

What was interesting to me about this show were its expectations about the audience's attention span. After Rolf's intro, we were treated to Ivan Rebroff's rendition of Kalinka. Ivan sang in Russian for 4 or 5 minutes (across 4.5 octaves), standing alone on stage, dressed like a cossack. There is no way you'd get something like this on prime time family television in 2008. There was also an over-long, godawful, but in its way charming, skit on Robin Hood (starring Rolf and Barbara Windsor); an overwrought (but quite entertaining) song by Vince Hill; Val Doonican incongruously singing The Answer (is Blowing in the Wind) and one other; plus The Young Generation doing a dance number called The Continental (here they are dancing to something else).

In some ways, it's a good thing that we no longer have to suffer some of this tedium. But when I found my own fingers itching and my attention drifting, it made me ask myself whether I (and people more generally) have lost something: the ability to enjoy simple pleasures, like a person singing alone onstage. I know that's what BBC 4 and Radio 4 are about, and I know there are plenty of people who appreciate culture in that way. But perhaps the difference is that it's no longer a general feature of the population. TV was much simpler, naive, and dull when I was growing up. Life was much more dull, to be honest. Partly because I grew up in a tiny market town, but largely because everyone was poorer, at least where I lived. By comparison, life today seems to be accelerating, getting bigger, brighter; we get more and more stuff; we endlessly throw things away, change things; and our attention spans narrow, flitting from the old to the new. (I know this isn't an original insight, but Rolf's show brought the issue vividly to my attention.)

My daughter has never had to wait until a particular time of day to watch children's TV; she's always had access to computers, where you can watch virtually any event on YouTube (bees making honey, the moon landing etc.); she's got her own CD player in her room (no TV, for as long as we can prevent it); she gets to go out to lots of parks, museums, the cinema etc.. Thankfully, she loves drawing and writing, and will spend hours making pictures for friends and family, so she can entertain herself. But she has endless opportunities and a wealth of "stuff" which just wasn't the norm when I was growing up in the 70s. Everything is just there, all the time. We try really hard to make sure she appreciates what she's got, and realises how lucky she is. (Though it's hard to instill those values when she earns two or three rewards of pencils, keyrings, stickers, badges etc. for good behaviour at school every week. When I was at school the reward was a book, once a year, for pupils who'd done really well.)

I also watched Survivors last night. Fairly bleak dystopian sf (perhaps the credit crunch is to blame), and I thought reasonably realistic. It made me think along similar lines to watching Rolf: as well as moving further and further into the unreal realm of the media (the hyperreal simulation of the media, even, as Monsieur Baudrillard would have it), we have also moved further and further from our hunter gatherer origins. I thought this show reflected that pretty accurately. The characters in Survivors, faced with a world decimated by a virus, react in a variety of ways: denial, bewilderment, displacement activity, land grabbing. Mostly, though, they hope it will all go away, carry on arguing with each other, blunder around blowing up petrol stations, and don't really know what to do without the infrastructure that modern society relies on. I think I'd be the same in their situation, without my computer and TV and electricity, which makes me a bit sad. Though I can grow vegetables.

One last thing: talking about dystopias always reminds me of what I consider the dystopia par excellence: The Genocides by Thomas Disch. I don't think you can get it in the UK at the moment, but you can probably get it second hand (here it is on Amazon US). The basic story is that aliens have planted crops on the whole of the earth, gradually killing off all the native life except for people. People end up living in the stalks and roots of their gigantic plants, like field mice. The characterisation is fantastic (as with all Disch's work), but what I liked in particular was how the impending extinction of humankind did nothing to dampen their bickering and infighting. I'm sure that's how the world would end.

Syndicate content