from selenium import webdriver import time driver = webdriver.Firefox() driver.get("https://www.baidu.com") driver.find_element_by_id("kw").send_keys("小瓶子喵") driver.find_element_by_id("su").click()
from selenium import webdriver import time driver = webdriver.Firefox() driver.get("https://www.baidu.com") driver.find_element_by_xpath("//input[@id='kw']").send_keys("xiaopingzi") driver.find_element_by_xpath(".//*[@id='su']").click()
from selenium import webdriver from selenium.webdriver.common.action_chains import ActionChains import time driver.get(r"https://www.baidu.com/") time.sleep(5) mouse = driver.find_element_by_id("s-usersetting-top") ActionChains(driver).move_to_element(mouse).perform() time.sleep(2) driver.find_element_by_link_text("高级搜索").click()
标签:定位,常见,webdriver,元素,driver,element,id,import,find From: https://www.cnblogs.com/pingzi66-ww/p/17100243.html