Locate web element with another web element in perfecto

238 Views Asked by At

I'm Automating a mobile application with the help of perfecto. The applications description is it has a common detail page and the position of web elements in the page keeps changing for each type of users like employees of type 1 or type 2 etc. When an employee of type 1 navigates to the page the first field will be Score and the second field will be Name. Whereas when employye of type 2 naviagtes the first field will be Name and not Score. Consider a page which has fields and values.

Example : Name : Stacy Age : 20

Here i can find the web element of Name using Relative Xpath //*[text() = 'Name']. Whereas for the value "Stacy" i can only find Absolute Xpath. Since the position keeps changing for different users i can't use Absolute xpath.

In perfecto, when i object spy on a element it automatically gives various webelements. And all of it is absolute xpath.

My question how to find the Value's webelement (Stacy) through the Name's webelement (Name).

Added Info: The HTML will be similar in Perfecto Object Spy. You won't be given the attributes and values

<html>
 <body>
    <main>
    <div>
        <div>
        <div>
        <div> 
            <section>
                <div>  // Name field
                <div>  // Value field

You'll be give Property and Values when you click on the element. If im clicking on Name field i'll get below property and value. From the below i wrote xpath for Name which is //*[text() = 'Name'].

PROPERTY   VALUE
id         Name_field
Text       Name 
0

There are 0 best solutions below