Ask a Question

Clicking certain area of an object on different screen sizes

SOLVED
nastester
Frequent 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
nastester
Frequent Contributor

Hey Alex, 

 

I tried this and am getting: "There was an attempt to perform an action a point, which beyond the screen"

I tried different pixel counts where you have the 10 and 5 as well. 

Hi,

 

"There was an attempt to perform an action a point, which beyond the screen"

This means that coordinates were calculated incorrectly 🙂

Stop script on the breakpoint at the line with the call to .Click() method and check that calculated coordinates are somewhere within the area with the ellipsis button.

The general idea is to get coordinates of the top-right corner of the control that contains ellipsis button and then shift down and to the left so that click was performed over the button.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
nastester
Frequent Contributor

When you say check the calculated coordinates, do you mean within the Locals debugger? And find the object in question: panelDevicedatacontainer?

do you mean [...]

Yes for both your questions.

 

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
nastester
Frequent Contributor

Hey Alex, 

Please see attached picture.

Am I looking for height and width of the object in question? I see clientHeight = 52 and clientWidth = 155 for page.panelDevicecardcontainer.panelDevicedatacontainer.  

ClientTop is 0 though so doing Top - 5 would be negative. Is that what's causing the above error?

 

nastester
Frequent Contributor

@AlexKaras  or @Marsha_R 

 

Alternatively, is there a way to select the button via the HTML class name?

See attached picture.

 

 

nastester
Frequent Contributor

This was solved by ensuring the project setting "Use XPath and CSS selectors for web objects" is selected. When it was selected, the object within an object could be mapped and thus clicked 

cancel
Showing results for 
Search instead for 
Did you mean: