from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
import time
from tkinter import filedialog
paths = filedialog.askopenfilenames()
chrome_options = Options()
chrome_options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
chrome_driver = "C:\Program Files\Google\Chrome\Application\chromedriver.exe"
driver = webdriver.Chrome(chrome_driver, chrome_options=chrome_options)
print(driver.title)
a = driver.find_element_by_css_selector("#input")
for path in paths:
print(path)
a.find_element_by_xpath('//*[@id="input"]').send_keys(path)
print(a)
#ActionClick = ActionChains(driver).click(a)
#ActionClick.perform()
time.sleep(5)
selenium 操作已打开网页批量提交数据
最新推荐文章于 2024-01-31 23:20:56 发布