I am working on browser automation and trying to attach the file using the Capybara software. I have a button by clicking which my script should start to upload the file. It works already in one place on the same website for me, so I am trying to implement it again.
The way I do it:
$private_key_path = '/Users/user1/Desktop/my_file.zip'
upload_generated_zip_btn = browser.all(:element, 'material-button', text: 'Upload generated ZIP')
browser.attach_file($private_key_path) do
upload_generated_zip_btn[0].click
end
But in fact my script just clicks the button, then appears the pop-up where I can manually choose the file. After several seconds the script fails with the following error:
ArgumentError: Capybara was unable to determine the file input you're attaching to
I looked at the docs, at original code but didn't understand the issue. The manual upload of the same files works. Tried to change the locator - no results.
The screenshot of the button code:
Source Code:

