Forum Discussion

Rodrigo20's avatar
Rodrigo20
Contributor
10 years ago

Maximize the screen just when running a web browser.

Hi Guys,

 

I'm running a crossbrowser test between some web browsers and some virtual browsers (mobile), but I have an issue...

What I need is, when I'm going to run the web browsers, I need the screen maximized, and I've been able to do that, but the problem is, the virtual browsers run on Chrome, so, if I define an operation to maximize the screen for chrome, the virtual browsers are maximized as well and I don't need that, I just need the web browsers maximized.

 

Could you guys please help me? How can I maximize just the web browsers and keep the virtual browsers at the same screen resolution?

 

 

Follow below a screenshot for a better understanding, about what I'm doing today:

 

maximize.png

 

 

 

 

Thank you very much!

  • Hi Rodrigo,

    To distinguish a virtual browser from a usual browser, check the browser's CommandLine property - for virtual browsers it includes the "--user-agent" argument.

    You can use a single If...Then check for all browsers, like this:

     

    check-virtual-browser.png

    And here's the script version, just in case:

     

    // JSript

    // Maximize the browser, except if it's a virtual browser
    var isRealBrowser = (aqString.Contains(Aliases.browser.CommandLine, "--user-agent", 0, false) == -1);
    if (isRealBrowser) { Aliases.browser.BrowserWindow.Maximize(); }

     

     

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Rodrigo,

    To distinguish a virtual browser from a usual browser, check the browser's CommandLine property - for virtual browsers it includes the "--user-agent" argument.

    You can use a single If...Then check for all browsers, like this:

     

    check-virtual-browser.png

    And here's the script version, just in case:

     

    // JSript

    // Maximize the browser, except if it's a virtual browser
    var isRealBrowser = (aqString.Contains(Aliases.browser.CommandLine, "--user-agent", 0, false) == -1);
    if (isRealBrowser) { Aliases.browser.BrowserWindow.Maximize(); }