Re: Searching for text in nested table cell
- From: "JWilliams" <ZZjohnZZwilliams_esq@xxxxxxxxxxxxx>
- Date: Sun, 31 Dec 2006 21:44:02 -0000
Resending.
"JWilliams" <ZZjohnZZwilliams_esq@xxxxxxxxxxxxx> wrote in message news:...
"Igor Tandetnik" <itandetnik@xxxxxxxx> wrote in message
news:%233MQZ$dKHHA.4912@xxxxxxxxxxxxxxxxxxxxxxx
JWilliams <ZZjohnZZwilliams_esq@xxxxxxxxxxxxx> wrote:
In the searchTable subroutine above the required text is matched
using:
If InStr(TD.innerText, "target cell") Then
However, because the target cell is nested, simply looking at
TD.innerText is insufficient because it can contain the text of cells
lower down the DOM hierarchy, resulting in a spurious match as shown
by the debug line beginning 4 below:
You can check TD.all.length to look for a cell that doesn't have any
child elements.
--
With best wishes,
Igor Tandetnik
Thanks Igor,
That works nicely for the simplified example I posted, however the real
target cell has the search text within a <span> </span> tag, which means
that the cell has 1 child element. Looking for a cell which has 1 child
element and contains the text results in a couple of spurious matches.
It's a pity you can't tell TD.innerText to only return text in the
immediate cell and not any nested cells.
I was hoping to look for text which is visible to the user, but think I'll
have to code something a bit more specific to the 'hidden' parts of the
HTML, e.g. there is <table> summary attribute I can use.
Thanks again for your response.
.
- Follow-Ups:
- Re: Searching for text in nested table cell
- From: Igor Tandetnik
- Re: Searching for text in nested table cell
- Next by Date: Re: Searching for text in nested table cell
- Next by thread: Re: Searching for text in nested table cell
- Index(es):
Relevant Pages
|
Loading