# HG changeset patch # User Robert McIntyre # Date 1319554322 25200 # Node ID 83e16df2288a72a569f52dcb53ae6ea9a20cdc7e # Parent d09937a6cb4bdc49d850ec82f089d6036957e387 still experimenting diff -r d09937a6cb4b -r 83e16df2288a browser.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser.pl Tue Oct 25 07:52:02 2011 -0700 @@ -0,0 +1,18 @@ +#!/usr/bin/perl + + +use WWW::Selenium; + +my $sel = WWW::Selenium->new( host => "localhost", + port => 4444, + browser => "*firefox", + browser_url => "http://www.google.com", + ); + +$sel->start; +$sel->open("http://www.google.com"); +$sel->type("q", "hello world"); +$sel->click("btnG"); +$sel->wait_for_page_to_load(5000); +print $sel->get_title; +$sel->stop; diff -r d09937a6cb4b -r 83e16df2288a main-firefox.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main-firefox.pl Tue Oct 25 07:52:02 2011 -0700 @@ -0,0 +1,8 @@ +#!/usr/bin/perl + +use WWW::Mechanize::Firefox; +my $mech = WWW::Mechanize::Firefox->new(); +$mech->get('http://google.com'); + +$mech->eval_in_page('alert("Hello Firefox")'); +my $png = $mech->content_as_png(); diff -r d09937a6cb4b -r 83e16df2288a play-browser.py --- a/play-browser.py Tue Oct 25 05:33:36 2011 -0700 +++ b/play-browser.py Tue Oct 25 07:52:02 2011 -0700 @@ -9,11 +9,21 @@ # Create a new instance of the Firefox driver #driver = webdriver.Firefox() -driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.FIREFOX) - +driver = webdriver.Remote("http://localhost:7055/wd/hub", webdriver.DesiredCapabilities.FIREFOX) # go to the google home page driver.get("http://tycho.usno.navy.mil/cgi-bin/timer.pl") -# you HAVE to quit if you're reusing firefox sessions +time.sleep(2) + +driver.refresh() + +time.sleep(2) + +driver.refresh() + +time.sleep(2) + + + driver.quit() diff -r d09937a6cb4b -r 83e16df2288a refresh-browser.py --- a/refresh-browser.py Tue Oct 25 05:33:36 2011 -0700 +++ b/refresh-browser.py Tue Oct 25 07:52:02 2011 -0700 @@ -5,6 +5,8 @@ from selenium.common.exceptions import TimeoutException from selenium.webdriver.support.ui import WebDriverWait # available since 2.4.0 import time +import sys + # Create a new instance of the Firefox driver #driver = webdriver.Firefox() @@ -13,7 +15,7 @@ # go to the google home page -driver.get("http://tycho.usno.navy.mil/cgi-bin/timer.pl") +driver.get(sys.argv[1]) # you HAVE to quit if you're reusing firefox sessions driver.quit()