capybara-select2
capybara-select2 copied to clipboard
Capybara::Poltergeist::MouseEventFailed
Hi, I'm trying to use this gem at my project, but when I put this in my spec it returns this error:
Capybara::Poltergeist::MouseEventFailed:
Firing a click at co-ordinates [188, 135] failed.
Poltergeist detected another element with CSS selector 'html body div#select2-drop-mask.select2-drop-mask' at this position.
It may be overlapping the element you are trying to interact with.
If you don't care about overlapping elements, try using node.trigger('click').
my files: select2_spec.rb:
#...a lot of anothers specs...
select2(@kuririn.email, from: 'User')
expect(page).to_not have_content @goku.email
expect(page).to have_content @kuririn.email
view.html.erb
<%= simple_form_for :filter, url: 'filter', method: 'get', html: {class: 'form-inline' } do |f| %>
<label for="user_id">User</label>
<%= f.input_field :user_id, collection: @project.users, as: :select,
value_method: :id,
label_method: :email,
class: "select_users_by_select2" %>
<% end %>
<% @users.each do |user| %>
<%= user.email %>
<% end %>
+1
+1
people, try this: https://gist.github.com/passalini/6614466
This works for me. Clicking on the select2-drop-mask is what the user would actually do to deactivate the select2 drop down.
find(:xpath, '//div[@id="select2-drop-mask"]').click
Well, it seems that this isn't going to get fixed I guess :(
I had this problem with contenteditable divs. The parent div would be reported as the "overlapping" element, even if I used CSS to set z-order. When making an example project to demo the error, I found that when I replace poltergeist with selenium the problem went away. YMMV
+1
I had this problem with popups. I have two step in my spec test. Step one, Open a popup and close it. Step two, click a button on the main page. Poltergeist executed step two before the popup really closed. So "overlapping" element occured. BTW, my spec test works well with selenium.