“Selenium: It’s Not Just for Testing Anymore” iPad contest

April 1st, 2010 by John Dunham

With the advent of an API-accessed Selenium-in-the-cloud service like Sauce OnDemand, using Selenium has become so easy and cost-effective that whole new applications for it become feasible and reasonable to consider. Just as robots can vacuum your living room, Selenium’s robotically-controlled browsers served up by Sauce OnDemand can be tasked to take care of your everyday routine browser tasks. Here are a few examples to stimulate your thinking:

  • set a cron job to kick-off a Selenium script to log into your Southwest Airlines account 23 hours and 59 minutes before flight time to check-in for preferred seating
  • set a cron job to kick-off a Selenium script to log into your eBay account, navigate to an auction of interest, and 30-seconds before the auction is over, check the minimum bid increment, and bid that amount over the current price for the object of your desire
  • buy tickets for the upcoming and sure-to-be-sold-out Phish concert seconds after they go on sale
  • send email to your boss from your gmail account while you’re out surfing

Okay, some of those are a bit over the top, but we’re sure our readers can come up with far better (and more savory) ideas. We’re so sure in fact, that we’ve just ordered a brand new 64-GB iPad with case that we’re going to give away to the person proposing the most creative, useful, and ethical use of Selenium for something besides website testing. Make your suggestions in the comments. The contest ends at 2100 PDT on April 15th. Decision of the Sauce judging is final, and the winner will be announced in a subsequent post.

And no, this is not a prank :-).

Share

Comments (You may use the <code> or <pre> tags in your comment)

  1. Gabriel says:

    set a cron job to click once a day in a tree’s image in this website http://www.clickarvore.com.br. Click Arvore ( arvore means tree ) is a project from a non governmental organization where you can click once a day in a image of a tree and in each click a new tree is planted. All expenses are paid by private companies.

  2. Quin says:

    Selenium could be at the heart of a service I have wanted for some time.

    There is a massive amount of data on the web that is not (very) programmatically accessible. People know the data they want and what sites it is on, but there are no APIs or the like for most of these, which results in lots of repeated, manual mining. Providing a simple interface for this could revolutionize data extraction: Load the site, the user selects some text (or image, etc), they give it a name, and from there Selenium can repeat similar tasks on demand for that name. In this way, any user can create the API they need for any site – no matter how dynamic or unwieldy.

    It is a bit of a grand goal, but it will be done at some point, by someone.

  3. Thomas Market says:

    In the modern age, computers have solved many of mankind’s problems by automating tasks that are prone to human error. Many of the remaining unsolved problems in several fields, including mathematics, science, and medicine, can be closely approximated through intensive computation. In particular, problems that involve a complete search of a well-defined solution space, such as protein folding, are well suited to computational methods.

    With the recent Javascript performance optimizations in several browsers, I propose implementing a client-side web application that can search for solutions and run simulations for many outstanding problems, such as identifying optimal protein structures, modeling the threats of near-Earth asteroids, and exploring the effects of climate change. We can then leverage Selenium to run these distributed browser instances in parallel to maximize computational throughput.

  4. I’ll give you two solutions as a starter.. to get your mind going a bit..
    (these are actual solutions I’ve sold).

    1. You can use Selenium for data entry fixes for a browser application that a business group is using. Lets say your team that is using selenium is on the business side of things. They notice they wrongly typed in production field values incorrectly and they would like to fix this. with some slight script modifications you can use selenium for “data entry fixes” for this type of issue. thus now the business has a solution that you can compare costs to “manual” data entry and win on ROI everytime. (remember not all selenium users have a coders and IT guys sitting around able to fix things for business users)

    2. For some specific fields, you can come up with an algorithm that can identify data entry errors depending on the field requirements. (the algorithm arent really that hard to create.. just takes a little thought)

    for example someone enters ‘wordpreds’ in a text field. your algorithm can flag that as a possible data entry error for a business user to review. After review, you can have that person feed those corrections using selenium.

  5. Quin says:

    Automating online class registration for college students would be a great way to use Selenium. Everyone has small and often floating windows of time that they can register, and it is really hit or miss (usually by seconds) if you get into an open seat or not. It is all very repetitive and formulaic – login, click through a few pages, fill in the dropdowns with the class information, and then see if there are any seats – exactly what Selenium can handle. Once setup for a particular registration system, students just need to put in the classes they want, and Selenium can deal with the repetition. Not only that, but it will be quicker and more precise than any human performing the same task.

  6. Sam S. says:

    I would use Selenium to be my daily social networking aggregator. Every morning Selenium could log into my Facebook, MySpace, Twitter, and LinkedIn accounts and follow the top 5 people I am mostly interested in reading updates from. This information could be emailed to me or posted to a private area on my website so that I can have easy access from any device such as my laptop or mobile phone.

  7. Cecilia says:

    I could use the Sauce OnDemand services to become a Computational Cluster on Demand service. There are many people using the MapReduce approach to process large data sets. Many folks have been working on JavaScript computational approaches, therefor the Sauce OnDemand browsers can be used as worker nodes in a MapReduce computation. These on demand browsers can receive their small piece of the computational effort via http and post back their results as well. The posted back results would then be used in the Reduce step. Depending on the size of the problem the usage would vary from a few browsers to potentially several hundred to thousands of browser instances. This is the beauty of the elasticity of a cloud service such as Sauce OnDemand – the ability to scale transparently to the user’s needs.

  8. Kirk Brown says:

    Perhaps use Selenium to aggregate events (movies, concerts, theater shows, lectures, etc) for a given city. A user could then select one or more events and push a button and buy tickets/register to those events. This would be good for being local. For visiting another city, throw in hotels and transportation combined with a map for short travels from hotel to events.

  9. Ken says:

    Selenium could be used to regularly collect statistics to use for a fantasy football league.

  10. I have used Selenium many times for non-testing activities:

    1. Record template scenarios from external web sites. Sometimes we found interesting new ideas that may be applied for our product as well. But it is hard to explain what is the key factors of the scenario, share it with remote team members, save it for future demonstration. Selenium helps with this task. IDE is used for quick recording.

    2. Selenium scenarios are used as communication tool between team members. To describe how the system should work we create Selenium scripts and attach them to emails, tasks, bugs, etc.

    3. Retrieve data from pages is the most frequent way of using Selenium. There are many sites with a lot of useful information like link directories, social networks, company websites, etc. Selenium provides a reliable way of navigation through the pages directly in browser and access each element of the page. Using RC mode allows storing information directly in the database or file system.

    4. Selenium scenarios are used for different demonstrations. It may be product features demonstration or potential competitors websites demonstration. Using manual control under script execution you may prepare great demonstrations easily.

    5. Check page structure rendering on different platforms. For this purpose we prepare basic image templates taken as screenshot of page rendered in prepared browser configuration with prepared ‘golden database’ for the system. These screenshots are done with Selenium scripts. After some changes in the design and functionality of the system we run the same Selenium scripts again and compare new images with template. Extending this framework with ability to set zones of interest for each page we have very powerful framework to check page rendering on more than 10 different platforms.

    6. Investigate HTML semantic quality of the website. For this purpose we record scenarios using IDE and check locators proposed us by IDE locator builders. If the best proposed locator is complex XPath expression then it is sign that page is not well structured. Bad structured HTML causes issues in tests and application JavaScript code.

    7. Automation of some repeated manual scenarios. There are some annoying scenarios like creation of task in some complex task tracking system or ordering a product in the online store (for example book store). To simplify my life I created some console utilities that require small amount of information to work (for example book ISBN or title, task name and description, etc.) and automate these boring scenarios for me.

  11. _phred says:

    Well, here’s what I’d do:

    1. Make a Flash stand-in with Javascript & Canvas that captures the user’s mouse and keyboard input and sends it to the server over, in order of preference, WebSocket / Comet / AJAX / JSONP.
    2. On the server side, use Sauce Labs to run the piece of Flash content in a browser that supports Flash and feed it a script to simulate the user input, then use the Sauce video capture feature to record back the interaction and capture the Flash video output.
    3. Stream the video frames back to the browser and use Canvas to display them.
    4. Release the Javascript/Canvas code as a bookmarklet and in-page script.

    This way, Sauce could be used to generate a static, animated, or interactive stand-in for any simple Flash content. Using an a neural net to map of (user interaction -> video output), the Flash stand-in service could cache deterministic Flash animations, such as navigation elements, which would speed up content delivery to concurrent users.

    Obviously, this isn’t going to work for Flash games and the like, given the increasing latency over the time of the user interaction (since each call to Sauce must simulate all user input from the moment the game starts), but it would make it possible to use & browse Flash sites on the iPad and similar devices.

    Yes, I realize that this is pretty crazy, but the intriguing thing is that it’s POSSIBLE given the SauceLabs API. ;-)

  12. Some fresh scenarios of using Selenium for non-testing purposes. I will start with already created:

    8. I have created Selenium based utility to search for employees in different social networks. Our HR managers has a lot of account in different social networks like LinkedIn, XING, etc. Some of them uses a lot of JavaScript and AJAX widgets, so using browser rendering is desired. The main goal is to seach all networks for employee from the nearest connections by simple seearch criteria like ‘has Senior Java Developer experience’. Script is provided with accounts to start with for each network and produces list of links to potential candidates.

    Some ideas for future:

    9. Sometimes I want to send congratulations to all my friends in the social network, but group operations are not allowed to avoid spam sending. Small Selenium script will solve this problem and I will say ‘Happy New Year!’ to all my friends easily. Any other group operations may be implemented the same way.

    10. I love traveling and have frequent task to check a number of low cost airlines for tickets in particular direction. I didn’t find any search engine site that aggregates all these companies. Creation of Selenium script will remove pain of filling long forms every time. Also it will aggregate all prices to select the best option.

    11. Another interesting task for Selenium is Java (or other program language) libraries monitoring. Not all libraries have release policy with notifications of the interested in developers about latest releases. Simple Selenium script may check artifacts download page of each library and check if new version is available. It will simplify life of the developers and allow them to use latest versions of the libraries.

  13. Anna Cyganowski says:

    Two ideas:

    1) Sparkfun Free Day. Wish I had thought of that back in January!

    2) Teach 10-year-old girls how to code by hacking Neopets. Maybe that’s an old school game by now, but I remember obsessing over finding more efficient ways to get free stuff from the Neopets store, or winning cheap auction items, both of which were next to impossible unless you spent hours refreshing and checking different pages on the site (guess that was the point…). Running my own successful Neopets shop was enough motivation to get me started on HTML. If Selenium existed in 2000, I could’ve been a Neopets tycoon! :)

  14. Thomas Market says:

    Here is a numbered list of my ideas.

    1. (copied from my post above). In the modern age, computers have solved many of mankind’s problems by automating tasks that are prone to human error. Many of the remaining unsolved problems in several fields, including mathematics, science, and medicine, can be closely approximated through intensive computation. In particular, problems that involve a complete search of a well-defined solution space, such as protein folding, are well suited to computational methods. With the recent Javascript performance optimizations in several browsers, I propose implementing a client-side web application that can search for solutions and run simulations for many outstanding problems, such as identifying optimal protein structures, modeling the threats of near-Earth asteroids, and exploring the effects of climate change. We can then leverage Selenium to run these distributed browser instances in parallel to maximize computational throughput.

    2. We can use Selenium to watch pages for changes. This can be useful in several ways, including tracking product availability on shopping sites and watching for changes in government policy documents posted online (as made famous when some presidential candidates changed their positions on issues). A great example of this is woot (http://www.woot.com), where products are only available for one day. This can also be useful for websites that don’t provide RSS feeds, since we can use Selenium to make the feeds for us.

    3. A script that uses Selenium to automatically follow people on Twitter who have recently started following you (i.e. “auto-follow”).

    4. XKCD #576 (http://xkcd.com/576/). Basically use Selenium to automatically buy a random $1 item with free shipping from Ebay every day. An interesting experiment to see what kind of things you would get.

    5. A “thumbshot” service in the cloud. Make a web application with an API allowing website owners to embed screenshots of the websites they link to. Of course, the web application would use Selenium to generate the screenshots.

    6. Price watcher for Amazon, Newegg, etc. Would allow us to track the price of certain products and automatically buy them if they fall below a certain price. It could also supply historical price charts and possibly predict when the price will drop.

    7. A system for “scheduled” tweets or emails, that allows you to write emails and tweets to be sent at a scheduled time and date.

    8. Automatically track packages (UPS, FedEX, etc) and alert us when they have arrived.

  15. I live in a small town with very few tech jobs, so I am a dedicated telecommuter. One of the best sources of telecommuting jobs is Craigslist. Unfortunately, Craigslist does not allow a global search, and requires users to search state by state and town by town, which is incredibly tedious. So several years ago I wrote a script in Watir that would search all of Craigslist for telecommute jobs.

    The script landed me one job and several job interviews in two separate job searches.

    Since Watir and Selenium are becoming alternate APIs for WebDriver, I thought it would be an interesting exercise to port my Watir script to Selenium. At first I thought it would not be possible, because Selenium lacked the equivalent of Watir’s links() methods. But Simon Stewart noticed my comment on Twitter and pointed out that in Selenium 2.0 one can do (in Ruby) “find_elements(:tag_name, ‘a’)” which has the same effect.

    I ran into another snag because Watir has no concept of an object becoming “obsolete”. In Selenium, if the test navigates outside of a page and then returns to that page, any references to page elements from the original examination of the page are now “obsolete”. Jari Bakken, the maintainer of the Ruby Selenium bindings, helped me figure out how to extract the links themselves from the page for later use. My click_page() method is essentially the code Mr. Bakken showed me to solve my example problem, with some extra fancy text checking added.

    So here it is: 30 lines of Ruby/Selenium2.0 to do a global search of Craigslist for telecommuting QA job listings, for every town in every state. And of course, with minor tweaks, it could be used to search for anything else on all of Craigslist as well.

    —-

    require ‘rubygems’
    require “selenium-webdriver”

    def do_search
    @browser.find_element(:id, ‘query’).send_keys “qa”
    @browser.find_element(:xpath, “//option[@value='sof']“).select
    @browser.find_element(:name, ‘addOne’).click
    @browser.find_element(:xpath, “//input[@value='Search']“).click
    unless @browser.page_source =~ /Nothing found for/
    @browser.find_elements(:tag_name, “a”).each do |j_link|
    if j_link.attribute(:href) =~ /\d+.html$/
    puts “#{j_link.text} \n #{j_link.attribute(:href)}\n\n”
    @outfile.puts(“#{j_link.text} \n #{j_link.attribute(:href)}\n\n”)
    end
    end
    end
    @browser.navigate.to @home_page
    end

    def click_pages
    @browser.find_elements(:tag_name, ‘a’).select { |e| ((e.text != “craigslist”) and (e.text != “w”) and (e.text != “or suggest a new one”)) }.map { |e| “#{e.attribute :href}jjj/” }.each { |url| @browser.get(url)
    do_search }
    end

    @outfile = File.new(“jobslinks.txt”, “w+”)
    @home_page = “http://geo.craigslist.org/iso/us”
    @browser = Selenium::WebDriver.for :firefox
    @browser.navigate.to @home_page

    click_pages

  16. A BAKER’S HALF-DOZEN WAYS FOR SELENIUM TO SIMPLIFY THE LIFE OF THIS QA ENGINEER

    PROBLEM: I sometimes let my Netflix queue go empty, leading to a movie-less weekend!
    SOLUTION: A Selenium-RC program inside a daily cron job can log me in, bring up my queue, retrieve the number of movies in my queue, and email me a warning when the number is below a certain threshold.

    PROBLEM: I like to download, file, and print my monthly bank statements. But logging into wellsfargo.com is an incredibly slow process!
    SOLUTION: Firefox can be configured to automatically download .pdf files. And a monthly cron job set up for the day after my statement cycle ends can run a Selenium program to provide my username and password, wait(!), click on the statement tab, and then click on the topmost .pdf link.

    PROBLEM: As an avid collector of Bette Davis memorabilia, I sometimes miss out on items which the Motion Picture Arts Gallery posts and sells (fixed-price) before I even know they’re available.
    SOLUTION: A Selenium-RC/Perl program inside an hourly cron job can enter “bette davis” as a search string on the site, scrape the hits, compare them to a simple online hash (DBM) of the previously seen hits, email me about any new items, and then store the new items in the DBM.

    PROBLEM: As a part-time community college instructor at De Anza College, I usually begin creating the required “green sheet” to hand out the first day of class only after the required minimum number of students have enrolled. But checking that number requires a click-click-scroll-click-scroll-click which gets “old” quickly.
    SOLUTION: A Selenium-RC program inside a daily cron job can do these six simple actions, scrape the number of enrollees, and email it to me, either when the number nears the minimum, or daily, whichever I prefer.

    PROBLEM: As a huge fan of a particular thriller writer, I like to know asap when another of his books has been published so I can figure out whether to buy it, check it out of the library, or ignore it (he wrote a sci-fi book once!).
    SOLUTION: A Selenium-RC/Perl program inside a daily cron job can click through all the works on amazon.com’s “Author” page for this author, scrape the hits, compare them to those in an online hash, email me about any new book, and then store the new one in the online hash to prevent further notifications about that particular work.

    PROBLEM: I like to know as soon as new info is available on a couple of topics in which I’m very interested. But it’s tedious to check every day or even every week.
    SOLUTION: A Selenium-RC/Perl program inside a daily cron job can use Google’s Advanced Search facility, specifically the “Date” pull-down, to look for pages that came into existence within the last 24 hours. If there are any, the program can send me an email notification; if there aren’t any, I won’t even think about the matter!

    JUST FOR FUN: I’m a huge fan of the English language. And merriam-webster.com provides a “Word of the Day” just for people like me! But my friends need help with their vocabulary too, especially one co-worker whom I’m helping learn English.
    SOLUTION: A Selenium-RC/Perl program inside a daily cron job lets me do an automatic post of the “Word of the Day” to my Facebook account!

  17. Interested says:

    So who won the contest?

  18. Sarah McKenna says:

    Allow moms to enter their baby products into a database, and have selenium automatically notify them if any of their products or brands issue a recall due to safety concerns!

  19. GantMocaito says:

    Hi

    Baltimore Plastic Surgery – Cosmetic Surgeon – Maryland Plastic Surgery Ctr.

    Thanks
    Kind regards

  20. [...] April 1st, Sauce Labs kicked off a contest, awarding an iPad to “the person proposing the most creative, useful, and ethical use of [...]

  21. I must say, I enjoy reading this website. Could tell me how I can keeping up to date with it? I feel I should let you know I discovered your blog through Lycos.

  22. Resources like the bromide you mentioned here wishes be very effective to me! I last wishes as enter a concatenate to this recto on my blog. I am positive my visitors on find that very much useful.

Leave a Comment