Hi Jörn,
From XPath specifications (http://www.w3.org/TR/xpath):
"
So I think position() is a 1-based index. You can also use the abbreviated syntax :
Concerning use of // instead of / in table, it's a problem that I already faced, but I didn't investigate. Perhaps it's a bug of HtmlUnit. Perhaps it's a bug of Jaxen (the component used by HtmlUnit to "understand" XPath). If you have time, could you please try with HtmlUnit alone, and submit a bug report on their site.
How can you count the number of columns with XPath ? Could you please provide an example ?
++
Julien
From XPath specifications (http://www.w3.org/TR/xpath):
"
child::para[position()=1] selects the first
para child of the context node"So I think position() is a 1-based index. You can also use the abbreviated syntax :
"para[1] selects the first para child of
the context node"Concerning use of // instead of / in table, it's a problem that I already faced, but I didn't investigate. Perhaps it's a bug of HtmlUnit. Perhaps it's a bug of Jaxen (the component used by HtmlUnit to "understand" XPath). If you have time, could you please try with HtmlUnit alone, and submit a bug report on their site.
How can you count the number of columns with XPath ? Could you please provide an example ?
++
Julien
----- Message d'origine ----
De : Jörn Zaefferer <[EMAIL PROTECTED]>
À : [email protected]
Envoyé le : Lundi, 31 Juillet 2006, 4h25mn 58s
Objet : [Jwebunit-users] Exposing more XPath abilities?
De : Jörn Zaefferer <[EMAIL PROTECTED]>
À : [email protected]
Envoyé le : Lundi, 31 Juillet 2006, 4h25mn 58s
Objet : [Jwebunit-users] Exposing more XPath abilities?
Hi!
While evaluating jWebUnit I started to miss a way to assert certain elements. My problem is a not-so-nice markup, that lacks IDs and names. I therefore need to use a loot of XPath to assert the structure and existence of certain elements. While I can write a XPath _expression_ to count the number of columns in the second table inside a certain div, there is no way to check this with jWebUnit.
As jWebUnit is hiding implementation via the plugin API, there is no way to directly access eg. the htmlUnit API.
Another problem I had while working with clickElementByXPath() and assertElementPresentByXPath():
Eg. I want to click the second link in a table with this _expression_:
clickElementByXPath("//[EMAIL PROTECTED]'portletMVC']/table//a[position()=1]");
It always clicks the first link, seems like the parts in brackets is ignored.
Also very confusing: assertElementPresentByXPath("//[EMAIL PROTECTED]'portletMVC']/table/tr/td");
There is a table with tr childs and trs whith td childs, but the assertion fails.
This only works this way:
assertElementPresentByXPath("//[EMAIL PROTECTED]'portletMVC']/table//tr//td");
Not quite want I'd like.
Any ideas?
Best regards,
Jörn
--
Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
While evaluating jWebUnit I started to miss a way to assert certain elements. My problem is a not-so-nice markup, that lacks IDs and names. I therefore need to use a loot of XPath to assert the structure and existence of certain elements. While I can write a XPath _expression_ to count the number of columns in the second table inside a certain div, there is no way to check this with jWebUnit.
As jWebUnit is hiding implementation via the plugin API, there is no way to directly access eg. the htmlUnit API.
Another problem I had while working with clickElementByXPath() and assertElementPresentByXPath():
Eg. I want to click the second link in a table with this _expression_:
clickElementByXPath("//[EMAIL PROTECTED]'portletMVC']/table//a[position()=1]");
It always clicks the first link, seems like the parts in brackets is ignored.
Also very confusing: assertElementPresentByXPath("//[EMAIL PROTECTED]'portletMVC']/table/tr/td");
There is a table with tr childs and trs whith td childs, but the assertion fails.
This only works this way:
assertElementPresentByXPath("//[EMAIL PROTECTED]'portletMVC']/table//tr//td");
Not quite want I'd like.
Any ideas?
Best regards,
Jörn
--
Echte DSL-Flatrate dauerhaft für 0,- Euro*. Nur noch kurze Zeit!
"Feel free" mit GMX DSL: http://www.gmx.net/de/go/dsl
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jwebunit-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Jwebunit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jwebunit-users
