cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft Edge - setting Browser Size Script not working like in other Browsers

Frequent Contributor

Microsoft Edge - setting Browser Size Script not working like in other Browsers

def Set_Browser_Size(iWidth):
  Delay(200)
  iHeight=800
  NameMapping.Sys.browser.BrowserWindow.Restore()
  page = NameMapping.Sys.browser.CoyotePage
  wnd = BrowserWindowByPageGet(NameMapping.Sys.browser.CoyotePage)

  iBorderWidth = wnd.Width - page.Width
  iBorderHeight = wnd.Height - page.Height

  iWinWidth = iWidth + iBorderWidth
  iWinHeight = iHeight + iBorderHeight
  
  Log.Message(aqString.Format("Set browser\'s viewport size to %ix%i (window size is %ix%i)", iWidth, iHeight, iWinWidth, iWinHeight),
      aqString.Format("%ix%i\n%ix%i", iWidth, iHeight, iWinWidth, iWinHeight));

  res = (iWinWidth > Sys.Desktop.Width) | (iWinHeight > Sys.Desktop.Height)
  if (res):
    wnd.Maximize()
    Log.Warning(aqString.Format("Viewport size was maximized as it exceeds current size of the desktop (%ix%i)",
        Sys.Desktop.Width, Sys.Desktop.Height))
  else:
    if ((wnd.Width != iWinWidth) | (wnd.Height != iWinHeight)):
      wnd.Position(0, 0, iWinWidth, iWinHeight)
  return res
  
def BrowserWindowByPageGet(Page):
  if (Page.Exists):
    if ("Page" == Page.ObjectType):
      if ('edge' == Page.Parent.ObjectIdentifier):
        wnd = Page.Parent.BrowserWindow(0)
      else:
        title = Page.contentDocument.title
        wnd = Page.Parent.FindChild("WndCaption", title + "*")
  return wnd

I am using this version (found on the smartbear site - not sure where it was exactly).

It works for all browsers except for Edge. The problem is the small border of the Browsers resolution 1913x800 should show the desktop view, but on a 1920x12xx only goes into desktop view if maximized - and setting the view to width 1913 will not result in the page being width 1913, so you have the add the border ... which works fine on chrome, firefox, iexplore in all versions 32/64 bit but not on edge ... when i set it to 1913 it says "no border" setting it to 1913 ... but there is one

2 REPLIES 2
Highlighted
Community Hero

Re: Microsoft Edge - setting Browser Size Script not working like in other Browsers

Frequent Contributor

Re: Microsoft Edge - setting Browser Size Script not working like in other Browsers

yes, but i guess this has nothing to do with the border of Microsoft Edge.

 

There must be something ... like wnd.InnerWidth / OuterWidth or whatever in Edge .. because I found out the Microsoft Edge Border is 9.8 px (4.9 left, 4.9 right side) but with the Function wnd.Width and page.Width you get the same result 1913px (in my case)

New Here?
Join us and watch the welcome video:
Watch the New Interview
7Mistakes
Join the September Hub-bub to show off, learn and win