Closed wonderer007 closed 2 years ago
You are calling the method correctly, but the node you are calling it on should be an <input>
element, not a button. Does the page you’re interacting with have a <form>
element with a file <input>
value?
Yes, page has <form>
element and a file <input type="text">
element inside it. This form is present inside a pop up/dialog. I am able to open the pop with the click though. But not able to attach file with it. Now tried this
browser.at_xpath("//input").select_file(Rails.root.join("file.png").to_s)
and it returns
{}
But, nothing happens on the the pop up/dialog.
Normal flow is,
@ttilberg can we have drag/drop file ?
I’m not a great person to ask about capabilities, @route is best. However, I suspect he won’t have much to add. It looks like this is an unsolved issue in the Puppeteer world as well, which is a much more mature library with many more people working on it. Being that both Puppeteer and Ferrum are interfaces for Chrome Devtools Protocol, you can usually check Puppeteer for potential solutions you can use in Ferrum to get a hint. In this case, it doesn’t look straight forward.
Actually calling click on file input element solved the issue @ttilberg thank you so much!
Can we upload/attach file on a button click ?
I think https://github.com/rubycdp/ferrum#select_file might be what I am looking for but its missing documentation.
I am trying this but
It return error
Thank you so much for this beautiful library