我有問題跑比賽XPATH方法:我使用的FF3.6硒XPATH匹配方法
@Test(groups = "regression")
@Parameters({ "baseUri", "locale" })
public void testShopping(String baseUri, String locale) throws Exception{
session().allowNativeXpath("false");
String shoppingLink = session().getAttribute("//div[@id='footernav_links']//a[matches(@href,'.*shopping.*')]/@href");
LOGGER.info(shoppingLink);
}
拋出異常
1:25.871 INFO - Command request: getAttribute[//div[@id='footernav_links']//a[matches(@href,'.*shopping.*')]/@href, ] on session 057af825ff224b16877a61b97b974b72 13:31:25.912 INFO - Got result: ERROR: Element //div[@id='footernav_links']//a[matches(@href,'.*shopping.*')]/ not found on session 057af825ff224b16877a61b97b974b72 13:3
,並得到了動機從文章驗證碼
how-to-use-regex-in-selenium-locators
謝謝......這句法更緊湊,我可以重新使用直通線substituion表達過。保存了一些代碼行:-) – 2010-08-11 14:33:34