How to get elements location ?

Answered

Iam new to selenium IDE ,
I have a dynamic grid containing 7 columns. The first and last column contains hyperlinks.  The first column hyperlink’s text are different but the hyper links of the last column contains the same text.
Now , I have written a code to search a hyper link by text and click on it. This code only works for the first column since the texts of those links are always different.
The problem is to write a code for the last column where the texts are always the same.

In the following code JID is the variable containing the text.

<tr>
<td>clickAndWait</td>
<td>Xpath=(//a[contains(text(),’${JID}’)])</td>
<td></td>
</tr>

I thought about searching the first column and get its location and then by that location moving forward towards the last link and then clicking on it.

I just wanted to do this …please help

Default Asked on October 3, 2014 in Software Testing.
Add Comment
  • 3 Answer(s)
    Best answer

    Hi lakshay,
    Thank you so much for reply 🙂
    By using simple Xpath trick, i can click on a link even if table is updating 🙂

    <td>clickAndWait</td>
    <td>//tr[contains(td[1], “sb001505”)]/td[9]/a[contains(text(),’Palletize’)]</td>
    <td></td>

    Default Answered on October 9, 2014.
    Add Comment

    RE: How to get elements location ?

    The image of the above query, attached for simplicity.

    Default Answered on October 3, 2014.
    Add Comment

    HI Geeta,

    Please go through the below link and let me know if you still face the issue.

    http://www.toolsqa.com/selenium-webdriver/handling-tables-selenium-webdriver/

    Best Regards,
    Lakshay Sharma

    Professor Answered on October 3, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.