Home > Software design >  how to upload file in headless mode without button tag
how to upload file in headless mode without button tag

Time:08-24

Is there any way to upload a file using rebot framework without tag and with the headless mode activated. I tried to use AutoIt and sikuliLibrary but they are not working .

best Regards

CodePudding user response:

If you have an input element, you can use Choose File keyword :

Choose File    id=input_id    C://document/file.txt

Check the documentation : https://robotframework.org/SeleniumLibrary/SeleniumLibrary.html#Choose File

CodePudding user response:

You can upload the file with Selenium by sending the file you want to upload to a special file.
This will work regardless to the headless or regular Selenium mode.
With Python language syntax it will be:

driver.find_element_by_xpath("//input[@type='file']").send_keys("the_full_path_to_your_file")

With other languages it will be similar, just with some syntax changes.

  • Related