my html looks like this
<tr>
<td>
<h3>Essentials></h3>
</td>
</tr>
<tr id="aui_3_2_0_1109">
<td class="tdOpenCloseButton"></td>
<td id="aui_3_2_0_1107" class="midProductColumn">Product 1</td>
<td class="midVersionColumn">5.0.0</td>
<td class="midDateColumn">2012-03-15</td>
<td>
<a class="button primary" href="
/web/details?downloadGroup=product&productId=229&rPId=2861">View Download</a
>
</td>
</tr>

<tr id="aui_3_2_0_1119">
<td class="tdOpenCloseButton"></td>
<td id="aui_3_2_0_1117" class="midProductColumn">Product 2</td>
<td class="midVersionColumn">5.0.0</td>
<td class="midDateColumn">2012-03-15</td>
<td>
<a class="button primary" href="
/web/details?downloadGroup=product&productId=230&rPId=2862">View Download</a
>
</td>
</tr>


i want to select the first hyperliink which is available for product 1..
and i dont want to use (//a)[1].. it would be better to somehow specify it
relative to the h3 element (Essentials)

any pointers??

thanks in advance..


-Regards

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to selenium-users@googlegroups.com.
To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Murali at Nov 29, 2012 at 10:28 am
    Hi,

    I think you can directly point it as //a[contains(text(),'View Download')]


    On Thursday, November 29, 2012 3:44:14 PM UTC+5:30, Girish wrote:

    my html looks like this
    <tr>
    <td>
    <h3>Essentials></h3>
    </td>
    </tr>
    <tr id="aui_3_2_0_1109">
    <td class="tdOpenCloseButton"></td>
    <td id="aui_3_2_0_1107" class="midProductColumn">Product 1</td>
    <td class="midVersionColumn">5.0.0</td>
    <td class="midDateColumn">2012-03-15</td>
    <td>
    <a class="button primary" href="
    /web/details?downloadGroup=product&productId=229&rPId=2861">View Download
    </a>
    </td>
    </tr>

    <tr id="aui_3_2_0_1119">
    <td class="tdOpenCloseButton"></td>
    <td id="aui_3_2_0_1117" class="midProductColumn">Product 2</td>
    <td class="midVersionColumn">5.0.0</td>
    <td class="midDateColumn">2012-03-15</td>
    <td>
    <a class="button primary" href="
    /web/details?downloadGroup=product&productId=230&rPId=2862">View Download
    </a>
    </td>
    </tr>


    i want to select the first hyperliink which is available for product 1..
    and i dont want to use (//a)[1].. it would be better to somehow specify it
    relative to the h3 element (Essentials)

    any pointers??

    thanks in advance..


    -Regards

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/p0nVShQjsjcJ.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Sel List at Nov 29, 2012 at 10:30 am
    that will match both the //a links
    On Thu, Nov 29, 2012 at 3:58 PM, murali wrote:

    Hi,

    I think you can directly point it as //a[contains(text(),'View Download')]


    On Thursday, November 29, 2012 3:44:14 PM UTC+5:30, Girish wrote:

    my html looks like this
    <tr>
    <td>
    <h3>Essentials></h3>
    </td>
    </tr>
    <tr id="aui_3_2_0_1109">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1107" class=**"midProductColumn">Product 1</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&**
    productId=229&rPId=2861">View Download</a>
    </td>
    </tr>

    <tr id="aui_3_2_0_1119">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1117" class=**"midProductColumn">Product 2</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&**
    productId=230&rPId=2862">View Download</a>
    </td>
    </tr>


    i want to select the first hyperliink which is available for product 1..
    and i dont want to use (//a)[1].. it would be better to somehow specify it
    relative to the h3 element (Essentials)

    any pointers??

    thanks in advance..


    -Regards


    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/selenium-users/-/p0nVShQjsjcJ.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Mark Collin at Nov 29, 2012 at 9:47 pm
    Selenium will pick the first one it comes across.



    From: selenium-users@googlegroups.com
    On Behalf Of Sel List
    Sent: 29 November 2012 10:30
    To: selenium-users@googlegroups.com
    Subject: Re: [selenium-users] Re: xpath help



    that will match both the //a links

    On Thu, Nov 29, 2012 at 3:58 PM, murali wrote:

    Hi,



    I think you can directly point it as //a[contains(text(),'View Download')]





    On Thursday, November 29, 2012 3:44:14 PM UTC+5:30, Girish wrote:

    my html looks like this

    <tr>

    <td>

    <h3>Essentials></h3>

    </td>

    </tr>

    <tr id="aui_3_2_0_1109">

    <td class="tdOpenCloseButton"></td>

    <td id="aui_3_2_0_1107" class="midProductColumn">Product 1</td>

    <td class="midVersionColumn">5.0.0</td>

    <td class="midDateColumn">2012-03-15</td>

    <td>

    <a class="button primary"
    href="/web/details?downloadGroup=product&productId=229&rPId=2861">View
    Download</a>

    </td>

    </tr>



    <tr id="aui_3_2_0_1119">

    <td class="tdOpenCloseButton"></td>

    <td id="aui_3_2_0_1117" class="midProductColumn">Product 2</td>

    <td class="midVersionColumn">5.0.0</td>

    <td class="midDateColumn">2012-03-15</td>

    <td>

    <a class="button primary"
    href="/web/details?downloadGroup=product&productId=230&rPId=2862">View
    Download</a>

    </td>

    </tr>





    i want to select the first hyperliink which is available for product 1.. and
    i dont want to use (//a)[1].. it would be better to somehow specify it
    relative to the h3 element (Essentials)



    any pointers??



    thanks in advance..





    -Regards





    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com
    .
    To view this discussion on the web visit
    https://groups.google.com/d/msg/selenium-users/-/p0nVShQjsjcJ.
    For more options, visit https://groups.google.com/groups/opt_out.





    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.



    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Murali at Nov 29, 2012 at 10:31 am

    On Thursday, November 29, 2012 3:58:09 PM UTC+5:30, murali wrote:
    Hi,

    I think you can directly point it as //td[contains(text(),'Product
    1')]/td[3]/a


    On Thursday, November 29, 2012 3:44:14 PM UTC+5:30, Girish wrote:

    my html looks like this
    <tr>
    <td>
    <h3>Essentials></h3>
    </td>
    </tr>
    <tr id="aui_3_2_0_1109">
    <td class="tdOpenCloseButton"></td>
    <td id="aui_3_2_0_1107" class="midProductColumn">Product 1</td>
    <td class="midVersionColumn">5.0.0</td>
    <td class="midDateColumn">2012-03-15</td>
    <td>
    <a class="button primary" href="
    /web/details?downloadGroup=product&productId=229&rPId=2861">View Download
    </a>
    </td>
    </tr>

    <tr id="aui_3_2_0_1119">
    <td class="tdOpenCloseButton"></td>
    <td id="aui_3_2_0_1117" class="midProductColumn">Product 2</td>
    <td class="midVersionColumn">5.0.0</td>
    <td class="midDateColumn">2012-03-15</td>
    <td>
    <a class="button primary" href="
    /web/details?downloadGroup=product&productId=230&rPId=2862">View Download
    </a>
    </td>
    </tr>


    i want to select the first hyperliink which is available for product 1..
    and i dont want to use (//a)[1].. it would be better to somehow specify it
    relative to the h3 element (Essentials)

    any pointers??

    thanks in advance..


    -Regards

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/llN1quxBt0UJ.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Sel List at Nov 29, 2012 at 10:39 am
    thanks for the try.. but /a is not a child of /td[contains(text(),'Product
    1') so this will fail.

    -Regards
    On Thu, Nov 29, 2012 at 4:01 PM, murali wrote:


    On Thursday, November 29, 2012 3:58:09 PM UTC+5:30, murali wrote:

    Hi,

    I think you can directly point it as //td[contains(text(),'Product
    1')]/td[3]/a


    On Thursday, November 29, 2012 3:44:14 PM UTC+5:30, Girish wrote:

    my html looks like this
    <tr>
    <td>
    <h3>Essentials></h3>
    </td>
    </tr>
    <tr id="aui_3_2_0_1109">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1107" class=**"midProductColumn">Product 1</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&**
    productId=229&rPId=2861">View Download</a>
    </td>
    </tr>

    <tr id="aui_3_2_0_1119">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1117" class=**"midProductColumn">Product 2</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&**
    productId=230&rPId=2862">View Download</a>
    </td>
    </tr>


    i want to select the first hyperliink which is available for product 1..
    and i dont want to use (//a)[1].. it would be better to somehow specify it
    relative to the h3 element (Essentials)

    any pointers??

    thanks in advance..


    -Regards


    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/selenium-users/-/llN1quxBt0UJ.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Maxim Vorobev at Nov 29, 2012 at 10:46 am
    1. //tr[.//*[text()='Product 1']]//a
    2. //*[text()='Product 1']/..//a[text()='View Download']
    3. //tr[contains(.,'Essentials')]/..//*[text()='Product
    1']/..//a[text()='View Download']
    4. //a[text()='View Download' and ../..//*[text()='Product 1']]
    ............
    ............
    etc.

    On Thu, Nov 29, 2012 at 1:33 PM, Sel List wrote:

    thanks for the try.. but /a is not a child of /td[contains(text(),'Product
    1') so this will fail.

    -Regards
    On Thu, Nov 29, 2012 at 4:01 PM, murali wrote:


    On Thursday, November 29, 2012 3:58:09 PM UTC+5:30, murali wrote:

    Hi,

    I think you can directly point it as //td[contains(text(),'Product
    1')]/td[3]/a


    On Thursday, November 29, 2012 3:44:14 PM UTC+5:30, Girish wrote:

    my html looks like this
    <tr>
    <td>
    <h3>Essentials></h3>
    </td>
    </tr>
    <tr id="aui_3_2_0_1109">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1107" class=**"midProductColumn">Product 1</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&**
    productId=229&rPId=2861">View Download</a>
    </td>
    </tr>

    <tr id="aui_3_2_0_1119">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1117" class=**"midProductColumn">Product 2</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&**
    productId=230&rPId=2862">View Download</a>
    </td>
    </tr>


    i want to select the first hyperliink which is available for product
    1.. and i dont want to use (//a)[1].. it would be better to somehow specify
    it relative to the h3 element (Essentials)

    any pointers??

    thanks in advance..


    -Regards


    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/selenium-users/-/llN1quxBt0UJ.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Sel List at Dec 1, 2012 at 11:05 am
    thanks for all your help guys :)

    -Regards
    On Thu, Nov 29, 2012 at 4:16 PM, Maxim Vorobev wrote:

    1. //tr[.//*[text()='Product 1']]//a
    2. //*[text()='Product 1']/..//a[text()='View Download']
    3. //tr[contains(.,'Essentials')]/..//*[text()='Product
    1']/..//a[text()='View Download']
    4. //a[text()='View Download' and ../..//*[text()='Product 1']]
    ............
    ............
    etc.

    On Thu, Nov 29, 2012 at 1:33 PM, Sel List wrote:

    thanks for the try.. but /a is not a child of
    /td[contains(text(),'Product 1') so this will fail.

    -Regards
    On Thu, Nov 29, 2012 at 4:01 PM, murali wrote:


    On Thursday, November 29, 2012 3:58:09 PM UTC+5:30, murali wrote:

    Hi,

    I think you can directly point it as //td[contains(text(),'Product
    1')]/td[3]/a


    On Thursday, November 29, 2012 3:44:14 PM UTC+5:30, Girish wrote:

    my html looks like this
    <tr>
    <td>
    <h3>Essentials></h3>
    </td>
    </tr>
    <tr id="aui_3_2_0_1109">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1107" class=**"midProductColumn">Product 1</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&*
    *productId=229&rPId=2861">View Download</a>
    </td>
    </tr>

    <tr id="aui_3_2_0_1119">
    <td class="tdOpenCloseButton">**</td>
    <td id="aui_3_2_0_1117" class=**"midProductColumn">Product 2</td>
    <td class="midVersionColumn">5**.0.0</td>
    <td class="midDateColumn">2012**-03-15</td>
    <td>
    <a class="button primary" href="/web/details?**downloadGroup=product&*
    *productId=230&rPId=2862">View Download</a>
    </td>
    </tr>


    i want to select the first hyperliink which is available for product
    1.. and i dont want to use (//a)[1].. it would be better to somehow specify
    it relative to the h3 element (Essentials)

    any pointers??

    thanks in advance..


    -Regards


    --
    You received this message because you are subscribed to the Google
    Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit
    https://groups.google.com/d/msg/selenium-users/-/llN1quxBt0UJ.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups
    "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to
    selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Ben Houghton at Nov 29, 2012 at 10:42 pm
    Similar to Maxim's suggestion, I'd use something along the lines of:

    //td[text() = 'Product 1']/following-sibling::td/a[text() = 'View Download']


    On Thursday, 29 November 2012 10:14:14 UTC, Girish wrote:

    my html looks like this
    <tr>
    <td>
    <h3>Essentials></h3>
    </td>
    </tr>
    <tr id="aui_3_2_0_1109">
    <td class="tdOpenCloseButton"></td>
    <td id="aui_3_2_0_1107" class="midProductColumn">Product 1</td>
    <td class="midVersionColumn">5.0.0</td>
    <td class="midDateColumn">2012-03-15</td>
    <td>
    <a class="button primary" href="
    /web/details?downloadGroup=product&productId=229&rPId=2861">View Download
    </a>
    </td>
    </tr>

    <tr id="aui_3_2_0_1119">
    <td class="tdOpenCloseButton"></td>
    <td id="aui_3_2_0_1117" class="midProductColumn">Product 2</td>
    <td class="midVersionColumn">5.0.0</td>
    <td class="midDateColumn">2012-03-15</td>
    <td>
    <a class="button primary" href="
    /web/details?downloadGroup=product&productId=230&rPId=2862">View Download
    </a>
    </td>
    </tr>


    i want to select the first hyperliink which is available for product 1..
    and i dont want to use (//a)[1].. it would be better to somehow specify it
    relative to the h3 element (Essentials)

    any pointers??

    thanks in advance..


    -Regards

    --
    You received this message because you are subscribed to the Google Groups "Selenium Users" group.
    To post to this group, send email to selenium-users@googlegroups.com.
    To unsubscribe from this group, send email to selenium-users+unsubscribe@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/9r_1IvwXv8AJ.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupselenium-users @
categoriesselenium
postedNov 29, '12 at 10:14a
activeDec 1, '12 at 11:05a
posts9
users5
websiteseleniumhq.org

People

Translate

site design / logo © 2022 Grokbase