2010-11-30 17 views
1
ctl00_Content_ctl00_chkProduct_0 
ctl00_Content_ctl00_chkProduct_1 
ctl00_Content_ctl00_chkProduct_2 
... 
ctl00_Content_ctl00_chkProduct_19 
ctl00_Content_ctl00_chkProduct_20 

我應該用什麼表達式來計算所有21個元素?如何爲此元素調用selenium.GetXpathCount?

我用

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_.']"); 

但他們沒有工作......請幫助。

回答

2

用途:

//*[starts-with(@id,'ctl00_Content_ctl00_chkProduct_')] 
+0

@Prostak:你是惠康! – 2010-11-30 22:29:53