Utilizing the Perl Selenium package known as WWW::Selenium
, I have encountered a perplexing JavaScript error while attempting to resize the browser window. The error message reads:
"Threw an exception: missing ; before statement"
.
Below is the code snippet:
use strict;
use warnings;
use 5.014;
use autodie;
use warnings qw< FATAL utf8 >;
use Carp;
use Carp::Always;
use WWW::Selenium;
my $url = 'http://www.google.com'; #for example
my $sel = WWW::Selenium->new( host => 'localhost',
port => 4444,
browser => '*firefox F:\WIN 7 programs\Web & Internet\Firefox 8 bit\firefox.exe',
browser_url => $url,
);
$sel->open( $url );
$sel->wait_for_page_to_load(10000);
my $res = $sel->window_maximize(); # Everything working fine until this point
$res = $sel->get_eval( q{ WebDriver driver = ((WebDriverBackedSelenium) selenium).getWrappedDriver();
driver.manage().window().setSize(1040,720);} );
# (Reference: http://stackoverflow.com/questions/1522252/, Eli Colner's post)
The program encounters a crash at this point with the message:
"Threw an exception: missing ; before statement"
If I remove the first line of JavaScript and retain only the second line like so:
$res = $sel->get_eval( q{driver.manage().window().setSize(1040,720);} );
This results in the error: "driver not defined"
.
I would greatly appreciate any help - Thank you in advance.
Helen
Note: This query has also been posted here: