How to selenium.GetXpathCount for this element?
ctl00_Content_ctl00_chkProduct_0
ctl00_Content_ctl00_chkProduct_1
ctl00_Content_ctl00_chkProduct_2
...
ctl00_Content_ctl00_chkProduct_19
ctl00_Content_ctl00_chkProdu开发者_StackOverflow社区ct_20
What expression should I use to count all 21 elements?
I've used
decimal count = selenium.GetXpathCount("//*[@id='ctl00_Content_ctl00_chkProduct_.*']");
decimal count = selenium.GetXpathCount("//*[@id='ctl00_Content_ctl00_chkProduct_[.*]']");
decimal count = selenium.GetXpathCount("//*[@id='ctl00_Content_ctl00_chkProduct_.']");
but none of them worked... please help.
Use:
//*[starts-with(@id,'ctl00_Content_ctl00_chkProduct_')]
精彩评论