diff --git a/gem/lib/capybara-select2.rb b/gem/lib/capybara-select2.rb index cb6d1d2..310e454 100644 --- a/gem/lib/capybara-select2.rb +++ b/gem/lib/capybara-select2.rb @@ -27,8 +27,8 @@ def select2(value, options = {}) end if options.has_key? :search - find(:xpath, "//body").find(".select2-search input.select2-search__field").set(value) - page.execute_script(%|$("input.select2-search__field:visible").keyup();|) + find(:xpath, "//body").find(".select2-container--open input.select2-search__field").set(value) + page.execute_script(%|$(".select2-container--open input.select2-search__field:visible").keyup();|) drop_container = ".select2-results" elsif find(:xpath, "//body").has_selector?(".select2-dropdown") # select2 version 4.0