Page 1 of 1

Invoke Action Focus - What does it do?

Posted: Fri Sep 18, 2015 9:49 am
by Fergal
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!

Re: Invoke Action Focus - What does it do?

Posted: Mon Sep 21, 2015 11:32 am
by Support Team
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

Re: Invoke Action Focus - What does it do?

Posted: Mon Sep 21, 2015 4:59 pm
by Fergal
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()?

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

Posted: Mon Sep 21, 2015 8:16 pm
by odklizec
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.

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

Posted: Tue Sep 22, 2015 4:56 pm
by Fergal
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.

Re: Invoke Action Focus - What does it do?

Posted: Tue Sep 22, 2015 5:59 pm
by odklizec
You are welcome ;)