正在尝试将文件上传到此网络'https://convertir-pdf.com/',然后用python notebok进行抓取工作,但是我找不到html的正确部分来进行上传或单击按钮。我的代码是:
from selenium import webdriver
import os
chrome_path = "D:\Descargas\chromedriver_win32\chromedriver.exe"
driver = webdriver.Chrome(chrome_path)
driver.get('https://avi-a-mp4.convertir-pdf.com/')
driver.maximize_window()
driver.switch_to_frame(0)
driver.find_element_by_id("download").send_keys(mypath+ '\\' + onlyfiles[7])
#driver.find_element_by_id('single-upload-form').send_keys(mypath+ '\\' + onlyfiles[7])
#driver.find_element_by_id('single-upload-form').click()
而且我一直都有这个错误:
NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="download"]"}
(Session info: chrome=81.0.4044.92)
在xpath下使用以解决您的问题
//span[@id='resumable-browse']