skip to Main Content

I have a table where i want to select a detail field based on the name.
For example i want to select a detail field based of the first John in the table (that is row 29).

username coll: usercard-table/div/div/div[2]///div[1]/div/div[2]/div/div[29]/div/div[3]/div/
details: usercard-table/div/div/div[2]///div[2]/div[2]/div/div[29]/div/div[3]/div/

How can i select the 29th row of the detail field based on a Name?

I have tried to use something like //div[2]/div/div[contains(.,’John)[1]]/div/div[3]/div

2

Answers


  1. Chosen as BEST ANSWER

    Hi Thanks for helping out. Hereby a simple example of the code. I want to select the div with the class="cell-icons-after-text based on the 2e John (divdivdiv[3])

    <div>
        <div>
            <div>
    
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"><span name="data">John</span></span>
                    </span>
                </span>
            </div>
            <div>
    
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"><span name="data">Will</span></span>
                    </span>
                </span>
            </div>
            <div>
    
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"><span name="data">John</span></span>
                    </span>
                </span>
            </div>
        </div>
        <div>
            <div>
    
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"><span name="data">John</span></span>
                    </span>
                </span>
            </div>
            <div>
    
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"><span name="data">Will</span></span>
                    </span>
                </span>
            </div>
            <div>
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"></span>
                    </span>
                </span>
            <div>
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"></span>
                    </span>
                </span>
            <div>
                </span>
                    <span name="indicators" class="cell-icons-after-text">
                    </span>
                    <span name="value" class="cellText">
                        <span class="ui-grid-cell-contents-value"></span>
                    </span>
                </span>
            </div>
        </div>
    </div>


  2. Do you have a simple html example code?
    You can try wildcars:
    //*[contains(text(),'John')]
    (i add the second quote missing in your example)
    And if you have 29 elements that you can non distingate, so:
    (//*[contains(text(),'John')])[29]

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search