user3749465
user3749465

Reputation: 32

Capybara/selenium browser refreshed with the blank page

After adding selenium-webdriver gem, when started capybara test, browser started to show home page and after it, refreshed with the blank page.

It cause to fail my tests that previously passed. Showing Capybara::ElementNotFound error.

I use capybara 2.2.1; selenium 2.42.0; ruby 2.1.0; rails 4.1.0; rspec 3.0

Here is my test:

require 'spec_helper'

describe "Navigation" do

    it "changing active menu element depending on route", js: true do

    visit '/'


    first(:link, 'WHAT IS DREAMDO?').click
    expect(find('.navigation').find('.active').find('a').text).to eq('WHAT IS DREAMDO?')

    first(:link, 'DISCOVER DREAMS').click
    expect(find('.navigation').find('.active').find('a').text).to eq('DISCOVER DREAMS')

    first(:link, 'DREAMDO WEEKLY').click
    expect(find('.dreamdo-menu-items').find('.active').find('a').text).to eq('Dreamdo Weekly')

    end

end
describe "Search", js: true do

    it "checks for the availability and search results" do
      search_text = find(:xpath, '//input[@id="search_text"]').set("chocolate")
      search_text.native.send_keys :return
      page.should have_content "chocolate"
    end

end

Could you, please, recommend me what to do?

Upvotes: 0

Views: 725

Answers (1)

ruby-digger
ruby-digger

Reputation: 128

Actually, it is not good to use selenium, because it can't run multiple instances: http://robots.thoughtbot.com/capybara-webkit

Try to use capybara-webkit, hope it will solve your problem.

Upvotes: 1

Related Questions