difference between Adapter.Click and Mouse.Click

Class library usage, coding and language questions.
i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

difference between Adapter.Click and Mouse.Click

Post by i.vasilyev » Sat May 06, 2017 4:58 pm

Hello.
Can somebody explain the difference between Adapter.Click and Mouse.Click

User avatar
Stub
Posts: 515
Joined: Fri Jul 15, 2016 1:35 pm

Re: difference between Adapter.Click and Mouse.Click

Post by Stub » Mon May 08, 2017 8:01 am

I use Adapter.Click to click on an item without worrying about where on the screen that might be. The Location parameter lets me control where on the item I click. The mouse will move to that area - Centre by default - and click on a control.

I tend to use Mouse.Click when I have already positioned the mouse where I want it to do something. e.g. drag/drop, right-click context menus.

ahoisl
Certified Professional
Certified Professional
Posts: 192
Joined: Fri Sep 07, 2007 8:16 am

Re: difference between Adapter.Click and Mouse.Click

Post by ahoisl » Tue May 09, 2017 7:21 pm

Adapter.Click internally calls Mouse.Click for local elements, but additionally does the following 3 things:
  • If you specify a click location, checks whether the location is inside the element bounds and reports a warning if it is not (check may be turned off in settings)
  • Decides whether the underlying element is a local or remote (device/webdriver) element to either call the Mouse.Click or Touch.Tap methods, respectively
  • If it is a local element (Mouse is used), calls EnsureVisible on the element (depending on UseEnsureVisible property)
Mouse.Click just moves the cursor to the specified location and performs a click (that is, itpresses the respective mouse button down and releases it again after a configurable time).
Mouse.Click without passing a location or element just clicks at the current mouse position.

Regards,
Alex
Ranorex Team

i.vasilyev
Posts: 30
Joined: Fri Sep 09, 2016 10:14 am

Re: difference between Adapter.Click and Mouse.Click

Post by i.vasilyev » Wed May 10, 2017 10:08 am

Thanks. Now it is clear enough
ahoisl wrote:Adapter.Click internally calls Mouse.Click for local elements, but additionally does the following 3 things:
  • If you specify a click location, checks whether the location is inside the element bounds and reports a warning if it is not (check may be turned off in settings)
  • Decides whether the underlying element is a local or remote (device/webdriver) element to either call the Mouse.Click or Touch.Tap methods, respectively
  • If it is a local element (Mouse is used), calls EnsureVisible on the element (depending on UseEnsureVisible property)
Mouse.Click just moves the cursor to the specified location and performs a click (that is, itpresses the respective mouse button down and releases it again after a configurable time).
Mouse.Click without passing a location or element just clicks at the current mouse position.

Regards,
Alex
Ranorex Team

Vijay
Certified Professional
Certified Professional
Posts: 7
Joined: Wed Apr 08, 2015 12:04 am

Re: difference between Adapter.Click and Mouse.Click

Post by Vijay » Fri Aug 25, 2017 3:19 am

Mouse.Click(item) works well on hover / floating items..

If listItem.Click() make the list disappear instead of selecting it, then use Mouse.Click(listItem)

Good for tricky controls such as : @controltypename='ValueListDropDownUnsafe'

ahoisl
Certified Professional
Certified Professional
Posts: 192
Joined: Fri Sep 07, 2007 8:16 am

Re: difference between Adapter.Click and Mouse.Click

Post by ahoisl » Sun Aug 27, 2017 7:51 pm

Vijay wrote:If listItem.Click() make the list disappear instead of selecting it, then use Mouse.Click(listItem)
Just for info: You can also set the "Use Ensure Visible" attribute of a repository item to "False" if you experience that behavior. This should have the same effect as calling Mouse.Click.

Regards,
Alex
Ranorex Team