我正在尝试将文件上传到此网站
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
my_mail = "email@yahoo.com"
driver = webdriver.Firefox("C:\\Users\Daniel\AppData\Local\Programs\Python\Python36-32\Scripts")
driver.get("https://www.ngs.noaa.gov/OPUS/")
assert "OPUS" in driver.title
driver.find_element_by_name("uploadfile").send_keys("C:\\Users\\Daniel\\Desktop\\popo\\uhc30010.15d")
email = driver.find_element_by_name("email_address")
email.send_keys(my_mail)
driver.find_element_by_name("Static").click()
但我收到此错误
selenium.common.exceptions.WebDriverException:消息:POST / session / b90ee4c1-ef51-4cc0-8543-dfd76c7a151d / file与已知命令不匹配
答案 0 :(得分:2)
作为一种变通方法,您可以在创建后将webdriver的_is_remote
属性设置为False:
driver = webdriver.Firefox()
driver._is_remote = False