Skip to content

Instantly share code, notes, and snippets.

@gordolio
Created July 26, 2011 23:39
Show Gist options
  • Save gordolio/1108372 to your computer and use it in GitHub Desktop.
Save gordolio/1108372 to your computer and use it in GitHub Desktop.
Selenium::Remote::Driver test with multiple drivers. If the output of these tests displays no messages other than tap, then the test was successful.
#!/usr/bin/perl
use strict;
use warnings;
use Selenium::Remote::Driver;
use Test::More;
my $driver = Selenium::Remote::Driver->new;
my $driver2 = Selenium::Remote::Driver->new(remote_server_addr=>'10.4.20.1');
$driver->get('http://www.google.com');
$driver2->get('http://github.com');
like($driver->get_title,qr/google/i,"Got google's title");
like($driver2->get_title,qr/github/i,"got github's title");
my $elem = $driver->find_element('q','name');
my $elem2 = $driver2->find_element('q','name');
isa_ok($elem,'Selenium::Remote::WebElement','got webelement1');
isa_ok($elem2,'Selenium::Remote::WebElement','got webelement2');
$elem->send_keys('hello world');
$elem2->send_keys('Selenium-Remote-Driver');
note "sent keys";
$elem->submit;
$elem2->submit;
note 'submitted';
undef $driver;
undef $driver2;
pass('destroyed drivers');
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment