On Fri, 26 Feb 2016 13:09:30 -0700
Sasha Pachev <[email protected]> wrote:

> I have tried your test and observed the same behavior. My guess there
> is a bug or incompatibility between Perl Selenium bindings and
> Firefox. So some functionality is broken.

Not necessarily. I tried the same, except to my target page. That works
correctly. I've also tried it on some pure HTML pages here and
elsewhere.

So it may be something Google is doing. In which case, either Google
should clean up their act, or the maintainers should change their
example code.

So now, can I use Selenium to grab the votes I need? I'll see what I
can do this afternoon.

Ultimate my goal is to scrape the votes files and get the votes into
a perl source file for further processing.

#!/usr/bin/perl -w

use WWW::Selenium;

$url = "http://legisweb.state.wy.us/2016/billreference/votes.aspx";;

my $sel = WWW::Selenium->new( host => "localhost",
                              port => 4444,
                              browser => "*firefox /usr/bin/firefox",
                              browser_url => $url,
                            );

$sel->start;
$sel->open($url);
$sel->select ('ctl00$cphContent$ddlLegType', 'Senate Files');
$sel->wait_for_page_to_load(50000);
print $sel->get_title . "\n";

# Grab a screen shot....
# $sel->capture_entire_page_screenshot('/home/charles/test.screen.shot.png');

# 
$url=$sel->get_expression("anchor=document.getElementsByTagName('a')[0].href");

# print ("\$url is $url\n");


$html= $sel->get_html_source();

$fileName = "/home/charles/senate.html";

open(SINK, "> $fileName") or die ("Couldn't open file $fileName\n");

print (SINK $html);

close (SINK);


# now scan the resulting page for VoteList relative URLs, such as
# "VoteList.aspx?ID=HB0001&Title=General government appropriations-2."

$sel->stop;




-- 

The right of the people to be secure in their persons, houses, papers,
and effects, against unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon probable cause,
supported by Oath or affirmation, and particularly describing the
place to be searched, and the persons or things to be seized.
-- U.S. Const. Amendment IV

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to