cuprite icon indicating copy to clipboard operation
cuprite copied to clipboard

Element is not focused with #fill_in?

Open YusukeIwaki opened this issue 4 years ago • 2 comments

Hi, I'm trying several Capybara drivers. When we evaluate with the following RSpec script (simple GitHub searching), Cuprite doesn't work as expected.

  • Selenium: 10/10
  • twalpole/apparition: 8/10 (https://github.com/twalpole/apparition/issues/76)
  • rubycdp/cuprite: 0/10
  it 'should search repository' do
    visit '/'

    fill_in('q', with: 'selenium')
    find('a[data-item-type="global_search"]').click

    output = all('.repo-list-item').map do |li|
      li.all('a').first.text
    end
    puts output
    expect(output).to include(match(/selenium/i))
  end
Failures:

  1) github search should search repository
     Failure/Error: find('a[data-item-type="global_search"]').click
     
     Capybara::ElementNotFound:
       Unable to find visible css "a[data-item-type=\"global_search\"]"
     # ./spec/feature/github_search_spec.rb:18:in `block (2 levels) in <top (required)>'
     # ./spec/feature/github_search_spec.rb:8:in `block (2 levels) in <top (required)>'

image

The search button appears only when textbox is focused. It seems Cuprite inputs 'selenium' text without focusing into the textbox.

We can avoid this issue by explicitly put find("input[name='q']").click before fill_in, however I think it is not so good because some users already have selenium-based specs. It would be useful us to use the existing selenium-based specs also in Cuprite.

YusukeIwaki avatar Jun 04 '21 07:06 YusukeIwaki

This issue is still causing trouble.

dhnaranjo avatar Nov 16 '23 01:11 dhnaranjo