Need help in locating an element by it's text within a span...

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Need help in locating an element by it's text within a span...

HS-10
I need to identify and then click on a page tab (implemented as a button) which contains a span with the page name text in the span. Below is part of the html code.      

<p>
<td nowrap="nowrap" id="page_443_c" class="SecondaryTabButtonCenter" align="center">
<button type="button" style="background-color: transparent;border-style: none;">
<span id="page_443_label">PAGE NAME</span>
</button>
</td>
       
<p>
I wish to find this element based on PAGE NAME because all of the id attributes are dynamic and generated at page load time so I can not reference them because I don't know the value ahead of time.


In selenium you can click on a link using "click link=link text" however this does not work for a button or span...

Any suggestions?

Brian
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=3454&messageID=9647#9647

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Need help in locating an element by it's text within a span...

Mike Williams-7
Brian Kirby wrote:

>  I need to identify and then click on a page tab (implemented as a
>  button) which contains a span with the page name text in the span.
>
>  <p> <td nowrap="nowrap" id="page_443_c"
>  class="SecondaryTabButtonCenter" align="center"> <button
>  type="button" style="background-color: transparent;border-style:
>  none;"> <span id="page_443_label">PAGE NAME</span> </button> </td>

You'll probably need to resort to XPath.  Try "//span[text()='PAGE NAME']"

--
cheers, MikeW                            http://www.dogbiscuit.org/mdub/


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Need help in locating an element by it's text

HS-10
Thanks Mike! I got it working.

Brian
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=3454&messageID=10038#10038

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]