Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Selenium positioning method

Shulou Source: shulou.com Published: 2022-06-03 04:40:29 11月25日 Update

Selenium's webdriver provides eight basic element positioning methods, the first six are directly located through the attributes of the element, and the latter two need to be located with the help of the firepath plug-in:

1. Locate through id: find_element_by_id ()

Eg:driver.find_element_by_id ("kw") .send_keys ("python")

two。 Locate through name: find_element_by_name ()

3. Locate through class: find_element_by_class_name ()

4. Locate through tag: find_element_by_tag_name ()

5. Locate through link: find_element_by_link_text ()

6. Locate through partial_link: find_element_by_partial_link_text ()

7. Locate through xpath: find_element_by_xpath ()

8. Locate through css: find_element_by_css_selector ()

Tags: Positioning elements methods attributes plug-ins Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Apple MySQL macOS