Python Forum
file upload from windows10 machine using send_key in selenium fails
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
file upload from windows10 machine using send_key in selenium fails
#1
Hi,

I am using python2.7.6, selenium 3.8.1, Windows 10 and Chrome browser

When I upload a file using selenium send_keys command, it fails with File not found error though the file is present:

>>> driver.find_element_by_css_selector('input[type=file].inputMetadataFile')
<selenium.webdriver.remote.webelement.WebElement (session="721fe652a589f67f90d089b5038ea579", element="0.4043670881107271-1")>
>>> driver.find_element_by_css_selector('input[type=file].inputMetadataFile').send_keys(r"C:\Python27\Scripts\metadata")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 479, in send_keys
'value': keys_to_typing(value)})
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "C:\Python27\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: invalid argument: File not found : C:\Python27\Scripts\metadata
(Session info: chrome=63.0.3239.132)
(Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.15063 x86_64)

Please help.
Reply
#2
Sounds like the file doesn't exist?
Reply
#3
Is metadata a file?
For Windows is much more common that all files have a file extension.
So eg metadata.txt or that metadata is a folder with a file inside metadata\foo.txt.
Reply
#4
there was a bug for firefox, but maybe there is one for chrome maybe. Not sure as i am not familiar with this section.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium suddenly fails to find element Pavel_47 3 6,301 Sep-04-2022, 11:06 AM
Last Post: Pavel_47
  Webcrawler with Selenium and Browsermob, Har file not complete Smartkoncept 0 1,310 Jul-23-2020, 08:06 AM
Last Post: Smartkoncept
  Upload big file on the server HTTP protocol Timych 1 2,409 May-15-2020, 07:12 AM
Last Post: snippsat
  selenium click in iframe fails 3Pinter 6 5,114 Apr-29-2020, 12:59 PM
Last Post: Larz60+
  upload big file in Django with process bar and i get error : MemoryError ma_norouzifar 3 4,385 Aug-06-2019, 06:57 AM
Last Post: fishhook
  python largesize(6GB) file upload fails nithya_g 2 4,144 Jan-29-2018, 09:11 PM
Last Post: micseydel
  unable to load file using python selenium purnima1 4 6,512 Dec-12-2017, 04:04 PM
Last Post: hshivaraj
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,626 Nov-03-2017, 08:41 PM
Last Post: metulburr
  Python Selenium Document Lookup and Download Automation Error - Target Machine active Guttmann 4 5,209 Apr-18-2017, 12:13 AM
Last Post: metulburr
  Issues running Selenium to download zip file davehughes87 4 6,314 Jan-12-2017, 02:19 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020