I'm trying to attach some files to an input area
page.attach_file('image', File.absolute_path('../pictures/picture.JPG'))
When I'm using Capybara.javascript_driver = :selenium
everything is working fine, but i only use selenium to have a vision of the result. I need to use Capybara.javascript_driver = :webkit
, and when I'm doing it, I'm getting the error
Failure/Error: page.attach_file('image', File.absolute_path('../pictures/picture.JPG'))
Capybara::Webkit::ClickFailed:
Failed to click element /html/body/div[2]... because of overlapping element /html/body/div[2]...div[3]/em at position 255, 653;
Is there a specific reason this overlapping element is making the test fails only with capybara_webkit
?
Is there a specific reason this overlapping element is making the test fails only with capybara_webkit?
Yeah, capybara-webkit
is just more honest. It allows you to interact only with really visible elements. It seems your file input isn't visible or hidden, may be only part of it is hidden.
The usual solution in tests is just to make it (element) visible, for example by evaluating of javascript and updating css properties of this HTML element.