Getting Started with Selenium

Jan 09, 2012 13:33

Installing

Download the Selenium server - this is a Java application which sits in the background.

Install Selenium::Remote::Driver (if you're using Perl)
Hello World
#!/usr/bin/env perl
use Selenium::Remote::Driver; my $driver = new Selenium::Remote::Driver( auto_close => 0 ); $driver->set_implicit_wait_timeout(30); $driver->get('http://www.bing.com'); my $search_field = $driver->find_element('sb_form_q', 'id'); $search_field->send_keys('foobar'); my $search_button = $driver->find_element('sb_form_go', 'id'); $search_button->click; Put It Together
Launch the Selenium server (I cheated and just double-clicked the JAR file). Now run the Selenium `hello_world` script you just wrote. Selenium will spawn a new Firefox instance, the test will be run in that instance, and that will then blink out of existence.

selenium, perl, tdd, programming, productivity, mac os x, howto, tutorial, engineers-log

Previous post Next post
Up