http://www.perlmonks.org?node_id=1092355

HelenCr has asked for the wisdom of the Perl Monks concerning the following question:

Dear esteemed PerlMonks

I am using the Perl Selenium package, WWW::Selenium.

Trying to resize the browser window, I am getting a mysterious JavaScript error: "Threw an exception: missing ; before statement".

Here is the code:

use strict; use warnings; use 5.014; use autodie; use warnings qw< FATAL utf8 >; use Carp; use Carp::Always; use WWW::Selenium; my $url = q{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(); # So far, this works fine $res = $sel->get_eval( q{ WebDriver driver = ((WebDriverBackedSelenium +) selenium).getWrappedDriver(); driver.manage().window().setSize(1040,768);} ); # (Following this: http://stackoverflow.com/questions/1522252/, Eli + Colner's post)

The program then crashes here with: "Threw an exception: missing ; before statement"

If I drop the first JavaScript line and just leave in the 2nd line, namely:

$res = $sel->get_eval( q{driver.manage().window().setSize(1040,720);} );

It bumps with: "driver not defined".

Help will be appreciated - Thanks in advance

Helen

Note: cross posted here:
http://stackoverflow.com/questions/24585497/