Forum Discussion

PetGin's avatar
PetGin
Occasional Contributor
7 months ago

Using FindChildByXPath method on mobile application

I am attempting to use TestComplete to test a local Appium connected Android device but it appears that many of the methods used for finding web objects are not supported in mobile. 

The following is a snippet of code to iterate through list of possible button text labels.

def navigateSecondary(possible_labels):
    # Iterate over the list of possible text labels
    for label in possible_labels:
        # Find the button element by its text label
       button = Mobile.FindChildByXPath("//button[@text='%s']" % label)
            if button.Exists:
            # Touch the button
            button.Touch()

But when I run the routine that calls this method I get the following Python runtime error, which points to the line that contains the Mobile.FindChildByXPath method.

AttributeError: The object does not support this property or method.

Has anyone had any luck using the FindChildByXPath method on a mobile application?