[wtr-general] Re: watir web-driver hwnd

2011-11-02 Thread Chuck van der Linden
As an alternative approach to this, have you considered perhaps just
creating a few pages with Javascript code in them to set the browser
size and location, and then having each window 'goto' the appropriate
page?

Or you can sometimes just inset the javascript as the URL.  I've used
this manually to create 'bookmarks' that will set the browser size
(prior to this becoming a common feature of developer tools)

Just send the browser to:  javascript:window.resizeTo(800,600)  as the
URL and it resizes.

Note however that while this used to work pretty well, there's a bunch
of javascript paranoid security stuff that  makes it tricky to use
that method still.
 For example if you try to cut and paste that into IE, it will strip
off the javascript.

And chrome won't even do it at all for a tabbed window (see long
thread here (http://code.google.com/p/chromium/issues/detail?id=2091)
of people begging chrome team to change their minds on this, some with
exactly the same needs as you)

 Current FF also seems to no longer like this little trick, although
you can find blog postings saying it works (but they are all from like
2008).  I just tried this in FF7 and even with javascript enabled, and
things set to allow it to move the browser entering
javascript:window.resizeTo(800,600) into the URL bar had zero effect.


On Nov 1, 10:27 am, Dan dfra...@gmail.com wrote:
 I wanted to use Win32API to do some window manipulation.  I ended up
 finding another way to do it.  Basically I have a number of browsers I'm
 opening and I want to be able to position them in different places on the
 screen.  Not really a functional test or requirement, but it'll make it
 easier for me to monitor the tests when running and nice for demos.

 I decided to change the title of the browser and then I can uniquely
 identify them if I need to be able to before calling the Win32API functions
 I need to.

 Something like this:

 browser.execute_script(document.title = 'UniqueBrowser #{x}')
 hWnd = FindWindow.call(nil, UniqueBrowser #{x} - Google Chrome)
 ret = MoveWindow.call(hWnd, 0, 0, 640, 512, true)

 Knowing full well that after I goto any other page that this title I've set
 will be gone.  I just really need it for the initial set-up.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


Re: [wtr-general] Re: watir web-driver hwnd

2011-11-02 Thread Jari Bakken
On Wed, Nov 2, 2011 at 10:07 PM, Chuck van der Linden sqa...@gmail.comwrote:



  Current FF also seems to no longer like this little trick, although
 you can find blog postings saying it works (but they are all from like
 2008).  I just tried this in FF7 and even with javascript enabled, and
 things set to allow it to move the browser entering
 javascript:window.resizeTo(800,600) into the URL bar had zero effect.



Yeah, most modern browsers now don't allow this unless the page owns the
window (i.e. a popup window) - so you can't resize or move the main window.
That's why we want to add a window handling API to WebDriver.

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com


[wtr-general] Re: watir web-driver hwnd

2011-11-02 Thread Chuck van der Linden
On Nov 2, 3:12 pm, Jari Bakken jari.bak...@gmail.com wrote:
 On Wed, Nov 2, 2011 at 10:07 PM, Chuck van der Linden sqa...@gmail.comwrote:



   Current FF also seems to no longer like this little trick, although
  you can find blog postings saying it works (but they are all from like
  2008).  I just tried this in FF7 and even with javascript enabled, and
  things set to allow it to move the browser entering
  javascript:window.resizeTo(800,600) into the URL bar had zero effect.

 Yeah, most modern browsers now don't allow this unless the page owns the
 window (i.e. a popup window) - so you can't resize or move the main window.
 That's why we want to add a window handling API to WebDriver.

Makes a lot of sense.  We used to have a number of little 'tricks'
that could be used to do this kind of thing when it was needed, but
since the browser's have changed to mostly disallow that, the
requirement for the tool to handle it has grown

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com