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 !!!
Sys.Browser("chrome").BrowserWindow(0).Position(0, 0, 1920, 1080);
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.
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:
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.
Your project is working fine on my laptop and two monitors. I am using 3 screens on the same OS.
Do you run this project on another machine (e.g. another window instance)?
That is interesting!! Is there any setting I am missing ?
> 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.
/Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
@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!
Community and Education Specialist