开发者

Selenium use a Tree class for expanding/clicking a node in a tree made with RichFaces

In Selenium RC I need to expand/click a node in a tree made with RichFaces. I have done a TreeUtil class, but at this point I am not sure how to click/expand a node (whic开发者_StackOverflow中文版h I retrieve with this xpath: "//div[@id='foo:classTree']/div/div/table["+nodeLevel+"]/tbody/tr/td/div/a") using only a nodeNumber and a nodeLevel.

Anybody has any idea?


Your question isn't very clear to me: are those click commands (with the XPath) not working because they result in "element not found" errors or because the click simply isn't causing the behavior your expect?

If it's an element-not-found issue, I suggest you use Firebug's $x function in the console to refine your XPath. You can run this function call in the Firebug function to see what the XPath is truly evaluating to:

$x("//div[@id=\"foo:classTree\"]/div/div/table[XXX]/tbody/tr/td/a")

Where XXX is some index. This is by far the best way to figure out the right XPath.

If the problem is that the click is just not really causing the tree map to change, try switching from click() to fireEvent("//xpath", "click") and see if that helps.


In my case clickAt() helped.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜