Forum Discussion

AutoBeginner's avatar
AutoBeginner
New Contributor
4 years ago

TestComplete-Resolution Issue

I am a beginner in automation world.Recently started using Testcomplete and  I scripted (keyword)  the web application using my laptop (resolution 1920,1080) and in laptop it is running successfully, but when I Switch to monitor the scrip breaks .

Tried running the below script at the starting of the execution,still issue is not fixed .Any help will be  much appreciated !!!

function Test()
{
Sys.Browser("chrome").BrowserWindow(0).Restore();
Sys.Browser("chrome").BrowserWindow(0).Position(0, 0, 1920, 1080);
}

Thanks

8 Replies

  • Hi,

     

    First off, it's best practices to keep the resolution and dpi of your test machine the same as the environment that you created your test cases in. It would be best if you kept it running at the same resolution. With that said, we cant really know why your tests are failing without looking at your code/keyword tests, and also your error logs, with the details of the failed step. My guess would be that you are using coordinate based actions within one of your steps, which would then fail because for example if you had a button to click based on a coordinate that is no longer there since the button moved due to resolution change, your tests would obviously fail. So get rid of coordinate based actions if possible and you should be good to go.

    • AutoBeginner's avatar
      AutoBeginner
      New Contributor

      Thank you for the reply. the resolution is actually same, except that it is monitor screen vs laptop screen. 

      I am not using XY coordinate, it is based on the object on Namemapping.Is there a global setup/configuration to turn off XY coordinate while recording script?

      The available properties of the namemapping object doesnt use any of those, how do I know for sure it is not using that behind the scene.

       

       

  • Wamboo's avatar
    Wamboo
    Community Hero

    Theoretically, it should have the same/similar resolution.

     

    The whole trick is to make the element available on the screen.
    Element ->, i.e. a button or other element of the page you want to use.

     

    You don't really use Sys object.

     

    Use NameMapping in your tests. You map objects to the repository and use them in further tests.

    The resolution and coordination of such an element on the screen are of no importance.

    TestComplete will dynamically search for this element on the screen if you have it mapped.

    There are already many great threads on the forum about NameMapping.

     

    Search and you will find this one, for example:

     

    https://community.smartbear.com/t5/TestComplete-Desktop-Testing/Project-without-NameMapping/m-p/187415#M14985

     

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    AutoBeginner :

    Hi,

     

    when I Switch to monitor the scrip breaks .

    Where? At what line of code? What is the text of the error in test log?

     

    Sys.Browser("chrome").BrowserWindow(0).Position(0, 0, 1920, 1080);

    Note that this line sets the size of the BrowserWindow object that is not the top-level one of the browser but one of the child ones. With the display size of 1920x1080 the above line will not set the size of the BrowserWindow object to 1920x1080 because some display space will be required for browser's caption, status line, main menu and, possibly, other objects that are siblings to the BrowserWindow.

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thanks everyone!

       

      AutoBeginner Did you figure out what was causing this? Please share your progress with us so the Community can see if more help is needed!