cuprite
cuprite copied to clipboard
FerrumError when using `attach_file`
Hello, I was not sure if this should be posted here or on the ferrum-repo, please move it if that is better (or I can post it there).
I have been trying to migrate from Selenium to Cuprite but ran into some issues with attach_file causing errors.
I reproduced it in a minimal example: https://github.com/davidwessman/reproduce-cuprite-attach-file
Versions used: Chrome: Version 90.0.4430.85 (Official Build) (x86_64) OS: Mac OS 11.2.3 cuprite: 0.13 ferrum: 0.11
Tested on both Rails 5.2 and the brand new 6.1 app.
Please get back to me if I can help debug anything 🙂
If it's something like this:
Ferrum::BrowserError:
Internal error
I encountered the same thing with a relative path name. Make sure you pass an absolute path to attach_file.
@trusche Thank you very much! That was indeed the error.
Maintainers: Would it make sense to add a fix for it to cuprite? Or can I add it to the documentation somewhere?
attach_file(File.expand_path(relative_path)) do
find("some-element").click
end
was all I needed to do.
Ferrum now requires absolute path and Cuprite will auto-expand local paths. I think we can close it.
I was bashing my face against a wall for hours before I found this issue. For me, trying to attach a path relative to working dir caused the Chrome browser itself to crash, but this wasn't visible at all until I turned headless off and saw it with my eyeballs... Ferrum would just respond with a timeout error.
Ferrum now requires absolute path and Cuprite will auto-expand local paths.
I dived through the stack trace, and I'm not seeing this, even on current master. This is where I'd expect to see it: https://github.com/rubycdp/cuprite/blob/c7dc979350295f29630ad6dba35227c5d8a707fc/lib/capybara/cuprite/browser.rb#L145
Maybe this is on a branch somewhere?
This does not appear to be fixed as of version 0.14.3 ...