Skip to content

Element is not focused with #fill_in? #157

@YusukeIwaki

Description

@YusukeIwaki

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

  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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions