开发者

using firefinder xpath to find elements

开发者 https://www.devze.com 2023-04-09 09:56 出处:网络
开发者_开发知识库I\'m using xPath with FireFinder.. but can\'t seen to get the right xPath to find an element..Sample html:
开发者_开发知识库

I'm using xPath with FireFinder.. but can't seen to get the right xPath to find an element.. Sample html:

<input type="button" onclick="ViewContact('9498')" value="View Contact" class="FormButton">
<input type="button" onclick="ViewContact('9499')" value="View Contact" class="FormButton">

I can find both of these with:

//input[contains(@value,'View Contact')]

But if I want to find just one via the id, like:

//input[contains(@onclick,'ViewContact('9498')')]

won't work, I assume the apostrophes aren't escaped right.. tried without them:

//input[contains(@onclick,'ViewContact(9498)')]

This works:

//input[contains(@onclick,'9498') and contains(@onclick,'ViewContact')]

but i'd rather not have to use 2 clauses.. any way to do this in one contains ?


Duh...Thanks :) At least I didn't use my login :)

Any tools that can help figure this out instead of stubling around trying things ?


You can use this XPath:

//input[contains(@onclick,"ViewContact('9498')")]
0

精彩评论

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