cancel
Showing results for 
Search instead for 
Did you mean: 

Cursor is not switched to the other input fields in hybrid mobile application.

Occasional Contributor

Re: Cursor is not switched to the other input fields in hybrid mobile application.

@Marsha_R,

 

I can see the SetText operation in the keyword test but when I run the recorded keyword test , text is not entered again in the text boxes.  Also recorded the script and I see the SetText method there as well, but again running the recorded test does not enter the text i pass. 

 

Highlighted
Community Hero

Re: Cursor is not switched to the other input fields in hybrid mobile application.

Hi,

 

> I have tried both. [...] problem not resolved.

That's strange...

Is the text still entered into some other field or something else happens?

For mobile controls .Touch() method exists as well. As per documentation, it is similair to .Click(), but you may try it as well.

I do not recommend to use .SetText() method in favor of .Keys() one.

What is displayed on the mobile screen if you set a breakpoint on the line with .Keys() call and run the code? I would expect that control is focused and on-screen virtual keyboard is displayed so that you can type text.

May it be that some previous actions require some time to complete and the problematic control cannot accept input until they are completed? Maybe you need to wait for some time before touching the input control?

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: Cursor is not switched to the other input fields in hybrid mobile application.

Hi @AlexKaras,

 

> Is the text still entered into some other field or something else happens?

Nothing happens when script statement for obj.SetText(string) or obj.Keys(string) is encountered .It just takes some time to go to next statement.

 

>For mobile controls .Touch() method exists as well. As per documentation, it is similair to .Click(), but you may try it as well.

 

I have not tried obj.Touch() till now since I thought to overcome this with Keys or SetText() etc and also since Touch() method requires the x,y co-ordinates too. I will try this one as a temperory solution and hope this is going to work as I have tried this once as Mobile.Device("Device Name").Touch(X,Y) and it worked.  

 

One more thing to let you know that Mobile.Device("Device Name").Keys(string) works but that does not solves my problem since this inputs the string starting from the current cursor position.SO if I do this then all the texts are going to be entered in the same field since my cursor is not switching to the other field even after finding the next web object successfully.

 

>What is displayed on the mobile screen if you set a breakpoint on the line with .Keys() call and run the code? I would expect that control is focused and on-screen virtual keyboard is displayed so that you can type text.

 

On-screen virtual keyboard is not opened to note.

 

>May it be that some previous actions require some time to complete and the problematic control cannot accept input until they are completed? Maybe you need to wait for some time before touching the input control?

 

One this I had noted that , while i was stepping-in the script with F11 , and checking the object browser , some times I had to refresh my object browser then only it was updating the element. 

One more thing to note here , I am finding my web objects from xpath which requires the web page opened and probably will not require the object browser to be updated except at least the web page, so ,even though objects are there but objects are not shown in the object browser until I refresh it, Keys and SetText methods may be failing for this reason since object is not in the object browser and the methods willl also not be available?

 

 

Also I was going through the object browser and checking evet element in the three ,elements are not properly shown.e.g. my username, password and signin button object are shown in the object browser tree but when i click on them they are not shown in the object preview.

 

Also when I try to focus in the device screen ,individual elemenets are not focused rather it takes any radom rectangle over the screen.

 

Please suggest.

 

 

 

 

 

 

 

Community Hero

Re: Cursor is not switched to the other input fields in hybrid mobile application.

Hi,

 

> Touch() method requires the x,y co-ordinates

Only if you need to touch at a certain point. Otherwise coordinates may be omitted and the touch will be done in the center of the object. See documentation for detailed description.

 

> I am finding my web objects from xpath 

This may matter. Really. Search by XPath is not recommended in TestComplete's world and should be used as a last resort only. Native TestComplete search functionality (Aliases, .FindXXX(), etc.) must be used wherever possible.

The case is that when TestComplete searches by XPath, the search is done by DOM means and the result is native DOM element (or null). If the XPath search finds some element, TestComplete tries to match it to the object from the Object Browser.

If TestComplete can find the matching object, then TestComplete wraps the native DOM object with its wrappers and return wrapped object as a result of the search. The returned object contains all methods and properties that are common for any onscreen object in TestComplete (like .Exists, .Keys(), etc.) or are specific to the given object (e.g. .TouchItem() method for some mobile lists).

If the matched object cannot be found in the Object Browser, then found native DOM object is returned as a result of the search. Obviously, this object does not contain any method or property provided by TestComplete and contains only native methods and properties provided by DOM. And only they can be used from test code.

 

So, the first thing I would suggest to do is to go away from XPath search and replace it with the one provided by TestComplete.

You can use the following code to figure out if TestComplete or native DOM object was returned as a result of search by XPath:

if (aqObject.IsSupported(<FoundObject>, 'Exists'))

  ' TestComplete object was returned. Any TestComplete method/property can be used

else

  ' Native DOM object was returned. Only DOM methods/properties can be used

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: Cursor is not switched to the other input fields in hybrid mobile application.

Hi @AlexKaras

 

Only if you need to touch at a certain point. Otherwise coordinates may be omitted and the touch will be done in the center of the object. See documentation for detailed description.

 

I will try this one.

 

Thanks.

 

Occasional Contributor

Re: Cursor is not switched to the other input fields in hybrid mobile application.

I did try this one. I can see the Touch() method in the list of methods available for the object, yet touch is not being simulated on the mobile Test device.

 

Also I used co-ordinates for  touch on object which opened the virtual keyboad on the android device but when I did use Keys(string) on object after this keyboard was closed and string was not entered in the text field.  

2018 NEWS
Top Kudoed Authors