Wednesday, March 11, 2009

Scripting the Southwest Checkin Page

I get kind of antsy flying Southwest. I sit by the computer counting the seconds before I can check in. I start wondering "Can't I just write a script to do this and run it at just the right moment?"

Yes I can. Someone tried it in Python, resulting in a 1,538 line nightmare and a lot of bug reports from users. It made me think about cost/benefit. How long does it take me to check in online like any other normal human? About 7 seconds. How long is typing 1,538 lines of anything? At 85 wpm, assuming 1 word per line, about 18 minutes. Just typing the script, if you had it in your head, takes 18 minutes. In reality, it probably took the developer about a week.

It's an interesting coding project, but it's just not worth the effort. I like being the one doing the clicking. If something goes wrong, I need to know immediately during checkin. I don't want an extra piece of software in the way. Using the web site directly is reassuring in this case.

Here's another option, though: use Selenium help you build a unit test. Execute the unit test to do the login. Here's what it looks like:

public void testNew() throws Exception {
selenium.open("http://www.southwest.com");
selenium.click("//img[@alt='Check In Online']");
selenium.type("txtConfirmNum", "YOUR CONFIRMATION NUMBER HERE");
selenium.type("txtLname", "YOUR FIRST NAME HERE");
selenium.type("lastName", "YOUR LAST NAME HERE");
selenium.click("submitCheckIn");
selenium.waitForPageToLoad("30000");
selenium.click("link=(CHECK ALL)");
selenium.click("submit");
selenium.waitForPageToLoad("30000");
}

There--10 lines of code. Took about 30 seconds. I myself typed a whopping three lines of code for this (the three lines with "YOUR..." in them).

Please don't use this code. This should go without saying. If the southwest.com developers feel like it, they can change the name, labels, or css IDs of anything on the page and then you're hosed. By the time you figure this out, you'll be stuck with "Group C" boarding passes.

No comments:

Post a Comment