Selenium Finding elements by class name in python

后端 未结 5 492
清酒与你
清酒与你 2020-12-14 06:05

How can I filter elements which having a same class?


 
  

Link1.

<
5条回答
  •  爱一瞬间的悲伤
    2020-12-14 06:28

    Use nth-child, for example: http://www.w3schools.com/cssref/sel_nth-child.asp

    driver.find_element(By.CSS_SELECTOR, 'p.content:nth-child(1)')
    

    or http://www.w3schools.com/cssref/sel_firstchild.asp

    driver.find_element(By.CSS_SELECTOR, 'p.content:first-child')
    

提交回复
热议问题