Maina Ninnu Maina Ninnu - 2 months ago 33x
C# Question

CodedUi:Mouse click with coordinates

How to click on a specific portion of a button in all screen types? I have a button with dropdown values, I need to click on the downarrow image, I tried below code:,new Point(250,45));

This works in my screen, this clicks somewhere else on desktops since axis changes. Suggest some workarounds or solutions.


Try giving a position relative to the control that is being clicked, instead of an absolute point, use this property:


like this:

var btnPosition= someBtn.BoundingRectangle

and then select the position you want to click based on the controls current position.

for example:

Point relativePoint = new Point(btnPosition.X + 40, btnPosition.Y - 40);,relativePoint );