I am trying to upload a file to this website
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()
but I am getting this error
selenium.common.exceptions.WebDriverException: Message: POST /session/b90ee4c1-ef51-4cc0-8543-dfd76c7a151d/file did not match a known command
sorry this was inadvertently broken. It will be fixed in the next release:
As a workaround, you can set the _is_remote
property of the webdriver to False after you create it:
driver = webdriver.Firefox()
driver._is_remote = False
来源:https://stackoverflow.com/questions/42754877/cant-upload-file-using-selenium-with-python-post-post-session-b90ee4c1-ef51-4