Author: ozizka(a)redhat.com
Date: 2010-04-08 17:01:34 -0400 (Thu, 08 Apr 2010)
New Revision: 918
Modified:
branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
* Workaround for HTMLUnit XPath bug - this time for the table headers in JMS tests.
Modified:
branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
---
branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2010-04-08
17:36:56 UTC (rev 917)
+++
branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2010-04-08
21:01:34 UTC (rev 918)
@@ -1232,7 +1232,8 @@
if( 0 == element.getRowCount() )
return null;
- String xPath = ".//tr[.//*[contains(string(),
'"+text+"')]]";
+ //String xPath = ".//tr[.//*[contains(string(),
'"+text+"')]]";
+ String xPath = ".//*[ name() = 'tr' and .//*[contains(string(),
'"+text+"')]]";
HtmlTableRow elm = (HtmlTableRow) element.getFirstByXPath(xPath);
if( null == elm )
return null;
@@ -1250,7 +1251,8 @@
if( 0 == element.getRowCount() )
return null;
- String xPath =
".//tr[.//a[normalize-space()='"+linkLabel+"']]";
+ //String xPath =
".//tr[.//a[normalize-space()='"+linkLabel+"']]";
+ String xPath = ".//*[ name() = 'tr' and
.//a[normalize-space()='"+linkLabel+"']]";
HtmlTableRow elm = (HtmlTableRow) element.getFirstByXPath(xPath);
if( null == elm )
return null;
@@ -1326,7 +1328,11 @@
// Get all TH from the first THEAD row that contains TH.
//String xPath = "./thead/tr[th and position()=1]/th";
- String xPath = ".//tr[th and position()=1]/th";
+ /// Workaround for HTMLUnit's buggy XPath.
+ //String xPath = ".//*[ name() = 'tr' and th and
position()=1]/*[name()='th']";
+ //String xPath = ".//*[ name() = 'tr' and *[name()='th'] and
position()=1]/*[name()='th']";
+ String xPath = ".//*[ name() = 'tr' and *[name()='th']
]/*[name()='th']";
+ //String xPath = "./thead/*[ name() = 'tr' and *[name()='th'] and
position()=1]/*[name()='th']";
List<HtmlTableHeaderCell> colHeaders = (List<HtmlTableHeaderCell>)
this.element.getByXPath(xPath);
if( 0 == colHeaders.size() ){
Show replies by date