0

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 
  • Please share your relevant code, HTML in text format here – cruisepandey Jun 09 '21 at 09:09
  • @cruisepandey The HTML code in Perfecto object spy is only with tags and no attributes are listed. Only the tags like 'HTML' followed by 'Body' then 'Main' Div etc. Please let me know if this is what you intended to ask or something else. – Stacy Overflow Jun 09 '21 at 09:42
  • for emp1 `first field will be Score and the second field will be Name` and for type emp2 it will be `first field will be Name and not Score.` - we will have to write locator based on other attributes not with exact name or score. So I would need to see the element structure first. – cruisepandey Jun 09 '21 at 09:46
  • @cruisepandey I have updated it in the question. – Stacy Overflow Jun 09 '21 at 10:22
  • I don't see any attribute in the shared HTML, can you please share that too, if there's any – cruisepandey Jun 09 '21 at 14:13
  • @cruisepandey The expected attributes aren't available in Perfecto. The only thing you see is the above html tags. Like how i have written, the same you'll see in their Appium DOM. – Stacy Overflow Jun 10 '21 at 05:02
  • @cruisepandey Used Xpath Axes - Following siblings seemed to work for me and i got the solution. Thanks for your time. – Stacy Overflow Jun 10 '21 at 12:54

0 Answers0