Deleting Trac Spam with Selenium

Posted November 12th, 2009. Filed under Code

The CFEclipse Trac wiki has been polluted with spam for quite some time now.  We’ve finally got the spam under control but faced a big task of going in and cleaning up all the spam related pages.  I started doing it manually and quickly realized this was something I could automate with a bit of creative thinking.

I cranked up Selenium IDE and recorded myself manually deleting a page or two.  Looking at the resulting HTML test code I started hacking.

I had a list of all the spam pages via the Index page from Trac.  I cleaned that up into a comma delimited list.  Than I hacked up a short ColdFusion script to loop through the list and write out some HTML following the format of the Selenium test:

<tr> <!-- click spam link -->
<td>clickAndWait</td>
<td>link=401_buy_oxytrol
</td>
<td></td>
</tr>
<tr> <!-- click delete page button on spam page -->
<td>clickAndWait</td>
<td>//input[@value='Delete page']</td>
<td></td>
</tr>
<tr> <!-- click confirmation delete button -->
<td>clickAndWait</td>
<td>//input[@value='Delete page']</td>
<td></td>
</tr>

In hindsight I could have probably hacked my CF loop directly into my Selenium script and saved (and run) it as a .cfm.

I had well over 100 spam links to delete. I fired off the revised Selenium script in Selenium IDE and set on a medium speed (I didn’t want anything to timeout) and it chugged through these in a minute or two.

Done!   Probably not an intended use for Selenium but it worked and saved me a huge amount of manual labor.

Selenium IDE 1.0 Beta 2 Released

Posted June 9th, 2008. Filed under Code

I was getting ready to run some Selenium tests and on checking the Open QA site noticed that they have released a new beta for Selenium IDE.

  • Changelog is here.
  • Release notes here.

One big one I see – Firefox 3 support! :)

Two New Testing/Automation Tools

Posted April 24th, 2008. Filed under Code

I found both these over the weekend and they both look really interesting:

Cubic – from the same folks that make Selenium

CubicTest is a graphical Eclipse plug-in for writing Selenium and Watir tests. It makes web tests faster and easier to write, and provides abstractions to make tests more robust and reusable.

CoScripter – IBM(?)

CoScripter is a system for recording, automating, and sharing processes performed in a web browser such as printing photos online, requesting a vacation hold for postal mail, or checking flight arrival times. Instructions for processes are recorded and stored in easy-to-read text here on the CoScripter web site, so anyone can make use of them.

Selenium 1.0 Beta

Posted April 1st, 2008. Filed under Code

I was poking around the Selenium site and noticed they have released 1.0 betas for several of their tools:

Update: Took me a bit to find the Core download – here is a link to the .zip

Ajax support also seems MUCH improved in Selenium IDE. I have a form with some jQuery autocomplete fields that I have been struggling to make work and just got it working with the new Selenium IDE with minimal tweaking!

Update Part II: Selenium IDE has a new look (see below). Also it appears there are a LOT more commands available. I was trying to get a script running with Ant and it was failing because it was running to fast. Within the IDE and the Testrunner – you can manually adjust the speed. After a bit of digging on the Selenium forums I discovered you can now do: setSpeed (value) within the IDE. This will set the speed the test runs at automatically.

CFMeetup: Pragmatic ColdFusion: Build, Test, Deploy

Posted December 13th, 2007. Filed under Code

John Paul Ashenfelter gave a great presentation this afternoon on CFMeetup. “Pragmatic ColdFusion: Build, Test, Deploy” covered really high level concepts of using Ant, version control and testing to manage your applications. I am already doing some of the same things but it is always neat to see how people do things differently.

One thing I liked is John had tagging built into his Ant scripts. He tags everything when his build file is run. I think I’m going to write up a ‘yes/no’ dialog so I can be prompted and skip it if I don’t want to create a tag. I’m also curious about using something like Cruise Control for continuous integration. I really want to learn more about how people implement that when developing web applications.

I’m also going to start using the SVNAnt task instead of calling exec. The syntax looks MUCH cleaner.

The CFMeetup Link to John’s presentation: http://experts.acrobat.com/p41566907/

How Do You Have Selenium Setup?

Posted November 30th, 2007. Filed under Code

I’m trying to come up with a standardized setup for Selenium so I can share it with our team and everyone can have the same configuration.

I have Selenium IDE installed within Firefox to record tests and I’m tinkering with different ways of setting up Selenium Core to run test suites locally. Our projects are stored in SVN and I want to store the test scripts there as well. I’m thinking I can store the scripts in a /testing directory and then include them within the webroot of my project on checkout using the svn:externals property.

If you use Selenium – how do you have it setup and configured? Do you use the Core or just Selenium IDE to run your tests?

Reminder: Selenium and Ant TACFUG Presentation

Posted November 5th, 2007. Filed under Code

When: Tomorrow (Tuesday) @ 6:30pm

Where: PStrat

What: An introduction to using Selenium to test your web applications. Also – a recap of my previous Ant presentation. All hastily put together this weekend while my kids threw Lego’s at me…

Come on out and hang with your fellow Triangle ColdFusion geeks and watch me fuddle through another presentation!! We both might learn something!

More info at the TACFUG site!

TACFUG Presentation: Selenium and Ant

Posted October 31st, 2007. Filed under Code

I’ll be giving a presentation on Selenium and Ant next Tuesday (November 6th) at the Triangle Area ColdFusion User Group. See the TACFUG site for location and details.

I’ll be showing how to setup and use Selenium and the Selenium IDE to create and run tests, and I’ll be giving a brief version of my previous Ant presentation (maybe combining Ant and Selenium!) as well for those who missed that.

If you haven’t checked out a TACFUG meeting in awhile I encourage you to come!!