-
I am trying to set up several automations and I am encountering two problems on two different web pages regarding the input to upload a doc. My code is as follows: `
` In this case only the PRESENT and ENABLED are printed and I always receive the error: Element {input[type="file"]} was not visible after 7 seconds! Not only when I do the send_keys but also when I do self.assert_element. The input is not inside any frame or shadow-root. I have tried accessing the input by its ID, Xpath, class etc etc. The strange thing is that I have no problem uploading the document with php webdriver selenium, ui vision or the selenium python. I have tried the demos or uploading files to the following websites and they go perfectly: Has anyone found themselves in the same situation? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For inexperienced people like me I leave the solution: Just do the sendkeys with the following: element = self.driver.find_element('css selector', 'input[type="file"]') |
Beta Was this translation helpful? Give feedback.
-
Sometimes there's a hidden file input field on a webpage. (Eg. SeleniumBase has a method for revealing those hidden file input fields: self.show_file_choosers() Here's a method for selecting a file to upload on that input field: self.choose_file(selector, file_path) Here's an example test that uses that: |
Beta Was this translation helpful? Give feedback.
Sometimes there's a hidden file input field on a webpage. (Eg.
'input[type="file"]'
)SeleniumBase has a method for revealing those hidden file input fields:
Here's a method for selecting a file to upload on that input field:
Here's an example test that uses that:
SeleniumBase/examples/test_show_file_choosers.py