in reply to Re^2: Selenium: Trying to resize window from Perl: getting a mysterious JavaScript error
in thread Selenium: Trying to resize window from Perl: getting a mysterious JavaScript error
http://stackoverflow.com/questions/1522252/
what makes you think Eli Corner's answer/solution is "javascript"? That is Java, or C# otherwise, because only those language bindings for WebDriver (or Selenium 2) expose a WebDriverBackedSelenium feature. All other language bindings, including Perl have no such option. So even if the code syntax is correct, on execution it will fail because that's not javascript (or shall I say the referenced classes/objects are not javascript).
Your options for a solution the way I see it are:
1. use real javascript code and Dave Hunt's solution (in that same SO thread) ideally should work, adapted for Perl:
$sel->get_eval("window.resizeTo(1024, 768); window.moveTo(0,0);");
2. use Perl WebDriver binding to correctly use Eli Corner's solution (adapted for Perl), not Selenium (RC) binding that you are currently using. Perl WebDriver binding is Selenium::Remote::Driver, not WWW:Selenium. You should then be able to do something like this (there is no need for the WebDriverBackedSelenium part in Perl, but it does mean you have to switch off using Selenium RC moving to WebDriver, there's no backward compatibility support, you need Java or C# for that):
$driver->set_window_position(0, 0);
$driver->set_window_size(640, 480);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Selenium: Trying to resize window from Perl: getting a mysterious JavaScript error
by HelenCr (Monk) on Jul 12, 2014 at 03:36 UTC |