Ask a Question

Running tests on laptop screen vs monitor screen

SOLVED
nsievert
Contributor

Running tests on laptop screen vs monitor screen

Hello!

My team has a TestComplete project, for testing a web application, mostly comprised of keyword tests but also some scripts. 

We have found that some tests are failing when ran on a laptop screen but work fine on a monitor screen. What can be done to fix this? 

 

The projects object tree model is to set to "tree" currently. Is there a setting or way that this can be changed for all? Or do individual objects need to be modified to allow for more recognition tolerance maybe? (if that's a thing)

 

As an example, I attached two pictures that show the display difference of two objects on a laptop screen vs a monitor screen. On laptop screen, the test clicks the wrong object and thus fails the test.

6 REPLIES 6
AlexKaras
Community Hero

Hi,

 

What error is posted to test log?

How problematic object is identified when the tested application is displayed on both laptop and desktop monitors?

 

Regards,
  /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.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

Hi Alex,

 So for one of the tests, an icon is clicked to open a modal. On a laptop screen, the "click" is performed but it's not on the object, so nothing is opened and the next test step fails:

  The window size is (0, 0); the screen rectangle: the left top corner is (72, 154), the right bottom corner is (72, 154).
 
Is there a way I can have the test be purely object based instead of positioning? Because of course that would vary on different screen sizes.
 
thanks for your help 

Hi,

 

The window size is (0, 0)

This means that the sought for object (UI element) was found but its size is zero. Obviously, zero-sized UI element cannot be clicked.

The reason why element size is zero depends on your tested application and how developers manipulate with UI (depending on screen size/resolution).

 

 test be purely object based instead of positioning?

No coordinate-dependent positioning occurred in this case, but just the target UI element is of zero size and thus cannot be clicked.

 

Regards,
  /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.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

In this case, it makes no sense that the object was zero as it is visible on both the laptop screen and monitor screen. 

What I found is that by default, when you keyword record a Click event, a coordinate pair is given to the action (not sure if this is a setting that can be disabled or not).  Changing the coordinates to the default value of  (-1, -1) or using a script click without coordinates like obj.Click(); the item is able to be clicked on both screen resolutions 

Hi,

 

It is great to hear that the problem has been solved.

 

Just a note to clarify:

it makes no sense that the object was zero as it is visible 

The message that you quoted ("The window size is (0, 0) [...]") clearly states that the size of the window is zero (in pixels). Zero-sized window cannot be visible just because it is not rendered on the screen. (Zero pixels are used.)

I don't know details of your tested application, but it is not a rare case when some object in the web application is not destroyed after been used, but is just hidden by setting its size to zero. And another object with the same characteristics is created when needed. From the user point of view this looks like the previous object remains on its place. But from programmatic point of view this is a new object. (Maybe, located on top of the previous one which has zero size.)

 

> Click event, a coordinate pair is given to the action

Yes, correct. When recorded, .Click() action always provided with coordinates where the click occurred and there is no option to disable this. Setting coordinates to -1 (or omitting them) makes Click action to click in the middle of the object.

 

Regards,
  /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.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================

Thank you for the clarification, Alex! 

cancel
Showing results for 
Search instead for 
Did you mean: