Using Capybara, I would like to simulate a click on the area within an image that is defined by an imagemap's area
element. Using .find
with or without visible: true
on the class/id attributes of that specific element isn't working - I get either a Capybara::Poltergeist::ObsoleteNode
error, or a Capybara::ElementNotFound
error. Instead if I simply trigger it via Javascript, like so, then my tests do pass:
page.execute_script('$(".ClassSelector").trigger("click")')
So the page is working like it should, but I'd like to know if I can avoid execute_script
in writing my tests.
I am using capybara
2.5 and poltergeist
1.7
Current poltergeist doesn't seem to work with image maps (I'll look at fixing that this weekend), and will return an error stating that a different element would be clicked. Selenium does work correctly with the image map so you could have those specs that require image maps run with selenium.
Update - I merged support for clicking on an area element of an image map into poltergeist master branch on Jan 24th, 2016 -- It should be in the next release