Selenium Finding elements by class name in python

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

How can I filter elements which having a same class?


 
  

Link1.

<
5条回答
  •  情深已故
    2020-12-14 06:37

    By.CLASS_NAME was not yet mentioned:

    from selenium.webdriver.common.by import By
    
    driver.find_element(By.CLASS_NAME, "content")
    

    This is the list of attributes which can be used as locators in By:

    CLASS_NAME
    CSS_SELECTOR
    ID
    LINK_TEXT
    NAME
    PARTIAL_LINK_TEXT
    TAG_NAME
    XPATH

提交回复
热议问题