#coding=utf-8
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
#打开网址
driver=webdriver.Firefox()
driver.get("http://image.baidu.com/")
time.sleep(2)
driver.find_element_by_id(‘sttb‘).click()
#time.sleep(2)
driver.find_element_by_id("stfile").send_keys("C:\\Users\\Administrator\\Desktop\\cat.jpg")
#关闭浏览器
time.sleep(5)
driver.quit()
时间: 2024-10-25 04:29:52