Forum Discussion
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
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.
- smartbearrj6 years agoContributor
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.
Related Content
- 10 days ago
- 10 years ago
Recent Discussions
- 2 days ago