hemant-manwani / php-webdriver-bindings

Automatically exported from code.google.com/p/php-webdriver-bindings
0 stars 0 forks source link

how to maximize the browser for php webdriver testcases #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. am created the php webdriver functional testcases,but am not able to 
maximize the browser window
2. Also how to do window focus in php webdriver
3.

What is the expected output? What do you see instead?
Need to maximize the browser.But not able to maximize

What version of the product are you using? On what operating system?
maven-php-plugin 2.0-snapshot,2.19 selenium jar on windows

Please provide any additional information below.

i don't know how to do this ,if any one know plz help me

Original issue reported on code.google.com by chelladu...@photoninfotech.net on 25 May 2012 at 2:09

GoogleCodeExporter commented 8 years ago
You can do it via javascript execution from WebDriver. See the code in 

https://github.com/daluu/php-webdriver-bindings/blob/master/phpwebdriver/WebDriv
erBackedSelenium.php

see these functions on that page:

windowMaximize()
windowFocus()

Original comment by manga...@gmail.com on 12 Jun 2012 at 7:47

GoogleCodeExporter commented 8 years ago
Am using the pure webdriver,this code is not working for window maximize.
Please send the steps todo windowmaximize in pure php-webdriver

public function windowMaximize(){
     print "\n".__FUNCTION__.":\n"; //log commands called like SeleniumTestCase
     $this->seleniumSpeedDelay();
     $winMaxScript = <<<WINMAXSCRIPT
if (window.screen){
window.moveTo(0, 0);
window.resizeTo(window.screen.availWidth,window.screen.availHeight);
}
WINMAXSCRIPT;

     $this->webdriver->execute($winMaxScript,array());
    }

Thanks in advance
chelladurai.A

Original comment by chelladu...@photoninfotech.net on 14 Jun 2012 at 5:01

GoogleCodeExporter commented 8 years ago
Hmm...I'll have to look into that then, to confirm the code works or not, in 
theory it should.

Original comment by manga...@gmail.com on 14 Dec 2012 at 8:25

GoogleCodeExporter commented 8 years ago

Original comment by manga...@gmail.com on 9 Mar 2013 at 6:46

GoogleCodeExporter commented 8 years ago
Has anyone figured this out yet? It is a bummer that I can not get the browser 
to maximize using the above JavaScript.

Original comment by afung...@gmail.com on 8 Apr 2013 at 5:15

GoogleCodeExporter commented 8 years ago
Curious to know, the suggested javascript mentioned fails for all browsers or 
just some? As I recall, Firefox stopped supporting that type of javascript 
code, but not sure about other browsers.

I haven't looked at the PHP WebDriver bindings in a while, but as I recall the 
current codebase didn't have support for window maximize, the suggested code in 
my fork was a javascript workaround. The proper workaround is to implement the 
JSONWireProtocol request/command to perform the action instead of javascript, 
but I haven't the time to look into that yet.

A sort of example of how you would make the JSONWireProtocol request via PHP is 
presented in the Facebook PHP WebDriver bindings home page

(under text "Set size of window that has $window_handle with 'POST'")
https://github.com/facebook/php-webdriver

you would then have to implement/port the equivalent code to this project's 
version of the PHP bindings. A code patch from the community is welcome.

Original comment by manga...@gmail.com on 9 Apr 2013 at 6:19

GoogleCodeExporter commented 8 years ago
I've now implemented the JSONWireProtocol command for this feature rather than 
using the javascript workaround. Give it a try and see if it works.

Fixed in revision 68, with a webdriver->windowMaximize() method.

Original comment by manga...@gmail.com on 9 Jun 2013 at 3:16