!!

Welcome to Selenium Webdriver Forum

As a web user you can read and search through forum content. Once you have registered and signed you can post topics, post replies, set up watch lists, modify forum settings, and use private messaging.

Author Topic: Using WebDriver to get element by table cell text  (Read 2187 times)

laredotornado

  • Web User
Using WebDriver to get element by table cell text
« on: April 01, 2012, 06:03:28 PM »
Hi,
 I'm using Maven 3.0.3 and Selenium 2.13.  Using WebDriver, how do I
 get an element (in this case, a "<td>" from a "<table>"), if all I
 know if the "td"'s text?  This table cell text will be unique on the
 page.
 
Thanks, - Dave

Mike

  • Web User
Re: Using WebDriver to get element by table cell text
« Reply #1 on: April 01, 2012, 06:03:46 PM »
On my web site all the table elements have generally been inside a div
 tag, so I used something like this:
 "//div[text()='Home']"
 You can probably modify that to be something like this:
 "//td[text()='Home']"
 
I am no expert on XPath notation by any means, so if I am wrong I am
 sure someone will point out the correct way.
 
Mike
 
On Nov 28, 12:35 pm, laredotornado <laredotorn...@zipmail.com> wrote:
 

- Show quoted text -

Manar Husrieh

  • Web User
Re: Using WebDriver to get element by table cell text
« Reply #2 on: April 01, 2012, 06:03:57 PM »
This xpath is correct but be sure that this text is unique in all tds
 
Regards,
 Manar Husrieh
 ” All for One, One for All”
 On Nov 29, 2011 12:13 AM, "Mike" <lvskip...@cox.net> wrote:
 

- Show quoted text -

Selenium Webdriver

Re: Using WebDriver to get element by table cell text
« Reply #2 on: April 01, 2012, 06:03:57 PM »

laredotornado

  • Web User
Re: Using WebDriver to get element by table cell text
« Reply #3 on: April 01, 2012, 06:04:09 PM »
Thanks.  That expression worked out great, - Dave
 On Nov 28, 4:13 pm, Mike <lvskip...@cox.net> wrote:
 

- Show quoted text -

 

Related Topics

  Subject / Started by Replies Last post
0 Replies
570 Views
Last post February 22, 2012, 06:30:38 PM
by Saurabh Gupta
0 Replies
600 Views
Last post February 22, 2012, 06:30:54 PM
by Saurabh Gupta
1 Replies
1072 Views
Last post May 02, 2012, 08:10:43 PM
by Ambika Rajagopalan
1 Replies
1300 Views
Last post May 17, 2012, 08:04:47 PM
by Željko Filipin
0 Replies
735 Views
Last post June 15, 2012, 03:00:42 AM
by kaushal247
1 Replies
1566 Views
Last post July 25, 2012, 10:35:18 PM
by Tarun Lalwani
10 Replies
4845 Views
Last post March 29, 2013, 06:35:54 PM
by lordrayden