本文最后更新于 2024-07-26T20:49:51+08:00
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| from selenium import webdriver from selenium.webdriver.common.by import By
driver = webdriver.Chrome() driver.get("https://www.baidu.com")
button = driver.find_element(By.ID, 'su') print(button)
button=driver.find_element(By.NAME,'wd') print(button)
button=driver.find_elements(By.XPATH,'//input[@id="su"]') print(button)
button=driver.find_elements(By.TAG_NAME,'input') print(button)
button=driver.find_elements(By.CSS_SELECTOR,'#su') print(button)
button=driver.find_elements(By.LINK_TEXT,'新闻') print(button)
input("press twice ...")
|
selenium_元素定位
https://ianwusb.blog/2024/07/26/selenium_元素定位/