Invoke Action Focus - What does it do?

Ask general questions here.
Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Invoke Action Focus - What does it do?

Post by Fergal » Fri Sep 18, 2015 9:49 am

What exactly does an "Invoke Action Focus" do?

I have a module with a step that clicks on a button on a web page in Google Chrome. Sometimes that click does not work, even though the button "Adapter Type" is "webelement". There is also a "Wait For Exists" step before the click action and sometimes the click is not completed, even after the "Wait For" has been successful.

Will putting an action to "Invoke Action Focus" before the click step (as shown below) help ensure the button is clicked?

[Ranorex 5.4.1 on Windows 7]

Image

Thanks!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Invoke Action Focus - What does it do?

Post by Support Team » Mon Sep 21, 2015 11:32 am

Hello Fergal,

The Focus() method tries to set the focus to the specific element. If the element is visible and the click is executed on the correct position there is no need to call Focus().

In your case, it is more likely that the webpage is not fully loaded and/or some background queries aren’t finished. Therefore, the click isn’t recognized correctly. Please ensure that the website is fully loaded before calling the click. Maybe you could also try to use the PerformClick() action instead of the Click() action.

Hope this helps.

Regards,
Robert
.
Image

Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: Invoke Action Focus - What does it do?

Post by Fergal » Mon Sep 21, 2015 4:59 pm

Thanks for your reply and suggestions Robert!
Support Team wrote:...you could also try to use the PerformClick() action instead of the Click() action.
What is the difference between PerformClick() and Click() and in what way could PerformClick() be better than Click()?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3938
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: App get crashed while tap on element in iOS Instrumented app

Post by odklizec » Mon Sep 21, 2015 8:16 pm

Hi,

PerformClick simply clicks the pointed element without moving mouse pointer to the element. Click action, on the other hand, first moves the mouse pointer to the element, then clicks it. There is no general rule as of when to use PerformClick and when Click. I found PerformClick useful with certain web elements, which occasionally failed to register Click, especially on VM systems. But there is also a good number of elements, which does not work very well with PerformClick ;) So if you are experiencing some problems with Click, try PerformClick and vice versa.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Fergal
Certified Professional
Certified Professional
Posts: 298
Joined: Tue Feb 18, 2014 2:14 pm
Location: Co Louth, Ireland
Contact:

Re: App get crashed while tap on element in iOS Instrumented app

Post by Fergal » Tue Sep 22, 2015 4:56 pm

odklizec wrote:...PerformClick simply clicks the pointed element without moving mouse pointer to the element. Click action, on the other hand, first moves the mouse pointer to the element, then clicks it....
Thanks very much for that odklizec, that's the clarification I was looking for.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3938
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Invoke Action Focus - What does it do?

Post by odklizec » Tue Sep 22, 2015 5:59 pm

You are welcome ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration