Skip to content

How to create locators using parent, child, preceding, and following elements? #273

Description

@AjithAutomationQA

I’m migrating an existing Appium + Java automation framework to Mobilewright.
In Appium, we can locate elements relative to other elements using XPath, for example:

// following
//preceding
//parent
//child

How can we achieve the same in Mobilewright?
For example, how can I create locators for:

* Parent element
* Child element
* Following sibling/element
* Preceding sibling/element

Is there a recommended Mobilewright API or locator chaining approach for these relationships?
For example, something conceptually similar to:
screen.getByTestId('parent').getByTestId('child')
or:

screen.getByTestId('element').preceding(...)
screen.getByTestId('element').parent(...)

What is the recommended approach for handling these relationships in Mobilewright?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions