tosha tosha - 4 months ago 6
Javascript Question

How to get text from table cell

I have to get the text

2010 manstreet san Jose ca
from the HTML below. I have tried using XPath
contains
. It doesn't work.--------------------------------------------------------------------------------------------------------------------

HTML:

<input id="St" type="hidden" value="1" name="St"/>
<div>
<div style="text-align:right;width:428px;">
<style> .myStyle { border: 1px solid silver; background-color: #F9E0E0; } </style>
<input id="hd" type="hidden" value="" name="hD"/>

<input id="Deleting" type="hidden" value="" name="D"/>
<h3>somthing</h3>
<br/>
<table width="100%" cellspacing="0" cellpadding="3" border="0">
<thead>
<tbody>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<tr>
<td>
2010 manstreet
<br/>
san jose CA 95124
</td>
<td>
</tr>
<tr>
<tr>
<tr>
<tr>
<tr>

Answer

I think you should use . instead of text() in your xpath as below :-

//tr/td[contains(., '2010 manstreet')] 

Hope it works...:)

Comments