How to test/verify window maximize without being language specific?

1,074 views
Skip to first unread message

David

unread,
Jun 12, 2013, 10:03:52 PM6/12/13
to selenium-...@googlegroups.com
This thought came up while working on third party (PHP) bindings to WebDriver via the JSONWireProtocol. If we execute window maximize via WebDriver, how do you verify it is actually maximized (beyond just checking that window size is greater than original, assuming original was not maximized). And perhaps to do that in a language agnostic way, with minimal to no reliance on 3rd party tools/libraries.

For Java, .NET, Python, and Ruby and Perl, you could likely use desktop GUI libraries to get the screen resolution and compare the maximized browser window size to that. But that's not a clean solution, and for PHP, there's not really much desktop library support since it's generally a web/server based language, so if going unclean route, would probably have to make shell call to some third party tool to get screen resolution.


Adam Goucher

unread,
Jun 12, 2013, 10:07:56 PM6/12/13
to selenium-...@googlegroups.com
use the js executor -
http://stackoverflow.com/questions/1248081/get-the-browser-viewport-dimensions-with-javascript

(which is pretty much the default answer for needing to do magic in
webdriver)

-adam
> --
> You received this message because you are subscribed to the Google
> Groups "Selenium Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to selenium-develo...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Adam Goucher

unread,
Jun 12, 2013, 10:10:43 PM6/12/13
to selenium-...@googlegroups.com
And then I read your question and realize this only solves part of the
problem. And while this doesn't answer the problem either, why? Have you
run into a situation where you fire off a maximize window command and it
/hasn't/ maximized?

David

unread,
Jun 12, 2013, 10:15:51 PM6/12/13
to selenium-...@googlegroups.com
So far no, I have not seen maximize fail, but with respect to "unit testing" as much as possible of ones code, it makes me wonder, how would you unit test it w/o visual verification? And ideally, would be nice to find a language & OS platform agnostic way to do said unit test, though I can understand that might not be possible sometimes.

Jason Leyba

unread,
Jun 13, 2013, 10:29:46 AM6/13/13
to selenium-...@googlegroups.com
This doesn't really answer you question for how to test this functionality, but I don't think we need a language agnostic way of doing it.  Every language binding does not need to verify all of WebDriver's functionality.  An acceptance suite for WD really only needs to be implemented in one language with a remote bridge for the others.  As long as the PHP bindings send the correct wire protocol commands, you don't need to worry about the functionality of those commands.

That's my 2c at least :-)

David

unread,
Jun 13, 2013, 8:11:54 PM6/13/13
to selenium-...@googlegroups.com
Thanks Jason for the input. So I guess in the case of window maximize, the client binding should just check for whether a NoSuchWindow exception occurred with the response or not. And if not, then it was a success.
Reply all
Reply to author
Forward
0 new messages