Eight methods:
Find_elementS_by_id () find_elements_by_name () find_elements_by_class_name () find_ Elements_by_tag_name () find_elements_by_link_text () find_elements_by_partial_link_ Text () find_elements_by_xpath () find_elements_by_css_selector ()
Instance:
From selenium import webdriverfrom time Import sleepdriver = Webdriver. Chrome () driver.get ("http://www.baidu.com") driver.find_element_by_id ("kw"). Send_keys ("Selenium") driver.find_ element_by_id ("su"). Click () Sleep (5)texts = Driver.find_elements_by_xpath ("//div/h3/a")for T in texts: Print (T.text) driver.quit ()
Operation Result:
Seleniumselenium Tutorial-90 days from entry to high salary "learning must see" Selenium-web Browser automationselenium_ Baidu Encyclopedia Selenium-web Browser Automation official Website function Automation test Tool--selenium Automation Test tool Selenium get started-csdn blog Python crawler from Getting started to discarding (eight) the use of Selenium library-pytho..._ Blog Park Selenium Usage Details-however persuasive-blog Park Selenium Chinese network –selenium installation, selenium use, selenium Chinese 、... selenium-csdn download Selenium automated test resource collation ( Including all versions of Chrome, CHROME..._CSDN blog Automation test _2017 new automated test Selenium course selenium_ "0 basis" to proficiency as long as 4 months _ monthly salary is not the dream "Amazon" buy Selenium on Z.cn_ Amazon overseas buy big "hui" poly _ a key really.
Reference: http://www.testclass.net/selenium_python/elements/
Selenium-webdriver-Positioning a group of elements