Selenium RC css selector with adjacent sibling combinator picks wrong table row
Edit: I made a mistake in the table data that I originally posted with. Correction's in bold.
I'm writing Python for Selenium RC. In the document below I'm trying to select the table row that contains "United States" and "1", but the selector is always selecting the row that contains "United States" and "214" instead. I think I know why. Looks like :contains() is matching the "1" in 214 and that row is selected.
This is my selector syntax:
self.selenium.click("css=table#filltbl tr td:contains(%s) + td:contains(%s)"%(country, area_code))
where country == "United States" and area_code == "1". It seems that the adjacent sibling combinator is being ignored.
How can I make :contains() match exactly "1" ?
Thanks and sorry for the confusion.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
. . .
<table class="wrapper" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<table id="filltbl" class="tfill" cellspacing="0" cellpadding="0">
<tbody>
<tr class="fill">
<td>United States</td>
<td>214</td>
<td> </td>
</tr>
<tr class="fill">
<td>United States</td>
<td>1</td>
<td> </td>
</tr>
</tb开发者_C百科ody>
</table>
. . .
check some examples that can be helpful for creating complex css3 locators
精彩评论