Forum Discussion

Rodrigo20's avatar
Rodrigo20
Contributor
10 years ago

Set the resolution of browser when it opens.

Hi Guys,

 

What I need is, when I'm going to run my tests (crossbrowser test), I need to set a specific resolution to the browser when it opens, but I did not find any video or topic that explains it. So, could you guys help me? How can I set a screen resolution to the browser when I'm running the test?

 

I really appreciate if you guys could help me. :)

 

Thank you very much!

5 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    You can use the restore and position functions to resize the browser window.

    Ex:

     

    //JScript
    Sys.Browser("chrome").BrowserWindow(0).Restore();
    Sys.Browser("chrome").BrowserWindow(0).Position(0, 0, 800, 600);
    • Rodrigo20's avatar
      Rodrigo20
      Contributor

      Thank you very much!

       

      But I would like to know, and to set the resolution using the GUI of TestComplete instead of using the script part, how could I do that?

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        The TestComplete project properties only have controls for the TestComplete UI.  

         

        To make the browser resolution change manually, you can change it from your browser before you run the test.

         

        If I was doing it and I didn't want to call Ryan's script from every test, then I would make a master test that calls all the other tests and put Ryan's at the top and bottom of that.  

         

        You could also just run Ryan's script manually at the beginning of your test and at the end, which would still give you control over it but avoid having to build a master test.