Webdriver io, file upload using input type=“file”

I am writing tests on CoffeeScript using and mocha. The code is processed using the CoffeeScript compiler.

In the process, I needed to upload a file to the server using the input type = "file" (display: none) element.

I try to transfer the file address as follows (of course, first making it visible: style.display = 'block'):

elem_input = $('div.class_1 input.class_2')
browser.elementSendKeys(elem_input.elementId, '/home/user/ ... /test.txt')

The file cannot be found, the error message "File not found" appears in the console.

I carefully checked the path, it is correct. If you upload the file directly through the interface, manually, there are no problems either.

What could be the reason for this situation and what could be the solutions to the problem?


  • file_path = browser.uploadFile(FILE_PATH)
    # Путь к загружаемому файлу на устройстве