2011-09-21 71 views
0
<b> 
<s> 
    <b>---</b> (1) 
    <b>---</b> (2) 
</s> 
</b> 
<s> 
    <b>---</b> (3) 
    <b>---</b> (4) 
</s> 
  1. 我想可能標籤,但僅是標籤的孩子的? 如何在這種情況下指定CSS? 這是好的:self.selenium.get_css_count("css=s b") 這會計算所有的b關係,s作爲父母,b作爲孩子。 4在上面的例子?如果沒有,你能幫助解決這個問題嗎?硒:CSS查詢

  2. 我想單擊標籤下的第四個(4)標籤。我會怎麼做? 如果我這樣做:self.selenium.click("css=s b:nth(1)) 它會選擇(2),那麼我如何指定(s b):nth(3)? 因爲s是b的父親。我想點擊第四種關係。 我希望這是有道理的。

  3. 就是第n()和第n-的類型()之間的區別

感謝 陽光

回答

0

你可以使用XPath的,而不是CSS選擇器來做到這一點。

您1.

get_xpath_count("//s/b") 

和2

click("//s[2]/b[2]")