Saturday 14 June 2008

Exporting firefox 3.0 history to selenium

In the new firefox 3.0 they've completely changed he way history is recorded, using a SQL engine to record it (details here).

I wrote a quik hack to export the history as a series of selenium tests:

sqlite3 .mozilla/firefox/98we5tz3.default/places.sqlite 'select * from moz_places' | awk -F\| '{print "<tr><td>open</td><td>"$2"</td><td></td></tr>" }'

sqlite3 locks the file, so you'll need to close firefox (or take a copy of the file) first. Cut and paste the results into an empty selenium test.

Obviously, your profile will have a different name.

1 comment:

Stuart Yeates said...

A much better SQL query string is, of course: 'select url from moz_places, moz_historyvisits where moz_places.id = moz_historyvisits.place_id and moz_historyvisits.visit_type = 1 order by moz_historyvisits.visit_date' which gives only those URLs which were explicitly visited (rather than the URLs is all the images etc) and in the order in which they were visited. The date format in use is a little obscure, but the linux command: `date "+%s%N"` gives the current time in the right format and 'date -d yesterday "+%s%N"' gives the time this time yesterday.