开发者

Selenium, XPath-Nodesets and PHPUnit

using an expression like (//div[@class='nav']//a)[5] to retrieve a specific element with Selenium (triggered through phpunit) never suceeds for some reason.

The Xpath is valid, using other Xpath expressions works fine, but once the Xpath contains brakets the Selenium server (2.0rc2) starts returning ERROR: Element (//div[@class='nav']//a)[5] not found. even it that element is present.

Is this a limitation of the PHP-Webdriver for Selenium, is there some kind of workaround (to get the nth element within a node-set)?

开发者_如何学编程

Cheers


From topic Can't get nth node in Selenium i see you can try prepending xpath= to your expression to get it work.


This was the final solution: xpath=(//div[@class='nav']//a)[position()=5]

Not sure why [5] didn't work, might still be an issue within phpunit

Cheers

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜