Forum Discussion

Rodrigo20's avatar
Rodrigo20
Contributor
10 years ago
Solved

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 s...
  • HKosova's avatar
    10 years ago

    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(); }