Forum Discussion

bo_roop's avatar
bo_roop
Contributor
7 years ago

How do I Maximize a specific instance of the Edge browser?

I'm trying to Maximize a popup window that gets launched by clicking a link in our web app.

 

Building on this issue: https://community.smartbear.com/t5/TestComplete-Functional-Web/How-can-I-capture-the-displayed-edge-browser-title-WndCaption/td-p/157166

 

 

I can get the title of the document just find, but I can't find a way to link that back to the Parent Browser object, since the page cannot be maximized (only the browser window can be). I've been playing around with the logic below, but Edge is not returning a different index value (nor is Firefox) when I have two Browser Windows open (not two tabs, but separate windows launched from the same process).

 

function foo()
{
  whichBrowser = "edge"
  whichWindowTitle = "View Messages"

  MaximizeBrowserWindow(whichBrowser, whichWindowTitle)
}


function MaximizeBrowserWindow(whichBrowser, whichWindowTitle)
{

  // Creates arrays of property names and values
  PropArray = new Array("ObjectType", "contentDocument.title");
  ValuesArray = new Array("Page", whichWindowTitle);

  // Search for the specific page
  mypage = Sys["Browser"](whichBrowser)["FindChild"](PropArray, ValuesArray, 100)

  // If the page exists, maximize the window
  if (mypage["Exists"])
  {
    Log["Message"]("I found you!")
    index = mypage.parent.parent.Browser(whichBrowser).Index
    Log["Message"]("Browser index = " + index)
    
    Sys["Browser"](whichBrowser)["BrowserWindow"](index-1)["Maximize"]()
  }
  else
  {
    Log["Warning"]("page not found.")
  }
}

So this logic works perfectly in Internet Explorer... but doesn't work in Edge (or Firefox).

 

If this is the wrong approach... that's fine. I just need a way to Maximize a specific window that I'm not launching via the Run Browser command.

1 Reply

  • Ultimately this boils down to a need to link the children of ["Browser"]("edge") together.

     

    I can get the page I'm working on, but I can't figure out which ["BrowserWindow"] is displaying it.