Ask a Question

Clicking certain area of an object on different screen sizes

SOLVED
nsievert
Contributor

Clicking certain area of an object on different screen sizes

I am encountering an issue where an object is clickable (to bring up a menu) but only in the upper right hand corner of it.  I cannot seem to map just the clickable area so when I do a test, I need to include coordinates of the object so that the correct area is clicked, thus opening the menu for additional items to be clicked. 

This works fine for me but when run on a co-worker's computer the test fails because our screen sizes are different so the object is not clicked in the right location.

 

Is there a way around this? 

 

Thanks!

16 REPLIES 16
Marsha_R
Community Hero

Yes.  Click by the object name instead of coordinates.  You have just found out why coordinates are not particularly reliable.

 

 


Marsha_R
[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

This does not work for this scenario. Only clicking the top right of the object opens the menu. And we have found that having coordinates causes the test to fail on other screens since positioning is not the same. 

Coordinates will always cause that issue.

Show us the detailed object spy results from that button please.

Marsha_R
[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

I attached the object spy results and a picture of the actual object with the clickable area circled in red. 

For object spy, we need the Advanced view please

Marsha_R_0-1631223556006.png

 


Marsha_R
[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
AlexKaras
Community Hero

Hi,

 

 I need to include coordinates of the object so that the correct area is clicked

Can you provide your code for this action?

 

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
================================

Sorry about that! Attached all

This particular test is keyword based but the underlying code is:

page.panelDevicecardcontainer.panelDevicedatacontainer.Click(144, 11);  //works for me

 

When my coworker records the click action, he of course gets different coordinates: 
//page.panelDevicecardcontainer.panelDevicedatacontainer.Click(111,6);

 

This doesn't work because the "object" to open the menu (see earlier screenshot) as the object seemingly needs to be clicked in top right only:
//page.panelDevicecardcontainer.panelDevicedatacontainer.Click();

Hi,

 

page.panelDevicecardcontainer.panelDevicedatacontainer.Click(144, 11);  //works for me

You may try to click, say 10 pixels left from the right edge of control and 5 pixels down from its top to hit the clickable area. Usually this works when test code is executed on systems with different screen resolutions. E.g.:

var pointX = page.panelDevicecardcontainer.panelDevicedatacontainer.Left + page.panelDevicecardcontainer.panelDevicedatacontainer.Width - 10;
var pointY = page.panelDevicecardcontainer.panelDevicedatacontainer.Top -  5;
page.panelDevicecardcontainer.panelDevicedatacontainer.Click(pointX, pointY);  // clicks 10 pixels left from the right control's edge and 5 pixels down from the top

 

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
================================
cancel
Showing results for 
Search instead for 
Did you mean: