capybara

Set Chrome as Default Browser for RSpec/Capybara

青春壹個敷衍的年華 提交于 2019-12-20 16:37:23
问题 I'm having some trouble getting Chrome to work with RSpec/Capybara on Ubuntu 13.10 64-bit. By default it launches Firefox - we tried to change this a variety of ways, including: http://actsasblog.ca/2011/09/28/how-to-use-chrome-with-capybara/ /home/.../xxx_spec.rb:8:in `<top (required)>': undefined local variable or method `“chromedriver”' for main:Object (NameError) We also tried: require 'capybara/rspec' require 'rspec' require 'selenium-webdriver' Capybara.register_driver :selenium do |app

Is it possible to interact with hidden elements with capybara?

只愿长相守 提交于 2019-12-20 15:50:10
问题 I have a file field that has opacity: 0 and is overlaping a fake button. Its a common css technic to fake a sort of "Upload button" that displays consistently across different browsers. Capybara doesn't allows me to call attach_file on that input. The error is Selenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted with . Anybody knows any way to force capybara to interact with invisible elements? The answer is still unanswered, but I

Is it possible to interact with hidden elements with capybara?

♀尐吖头ヾ 提交于 2019-12-20 15:49:24
问题 I have a file field that has opacity: 0 and is overlaping a fake button. Its a common css technic to fake a sort of "Upload button" that displays consistently across different browsers. Capybara doesn't allows me to call attach_file on that input. The error is Selenium::WebDriver::Error::ElementNotVisibleError: Element is not currently visible and so may not be interacted with . Anybody knows any way to force capybara to interact with invisible elements? The answer is still unanswered, but I

Running parallel selenium tests with capybara

天大地大妈咪最大 提交于 2019-12-20 13:17:07
问题 Background: I have a set of Capybara integration tests running against my Rails 3 Application. For the other parts of the test suite I'm using Rspec . I have a selenium 2.6.0 standalone server hub on my Mac OSX dev machine. java -jar selenium-server-standalone-2.6.0.jar -role hub I'm running several virtual machines each hooked up to the hub with a selenium node: java -jar selenium-server-standalone-2.6.0.jar -role webdriver -hub http://0.0.1.12:4444/grid/register port 5555 -browser

Has anyone figured out a way to run the same cucumber scenario on multiple browsers/web drivers?

萝らか妹 提交于 2019-12-20 10:41:44
问题 I'm using cucumber + capybara for some web automation testing. I'd love to be able to wire up my own tag (something like @all_browsers before the scenario) and have it run against a list of web drivers I set (celerity, selenium on firefox, ie and chrome). I don't want to have to write the scenario 4 different times with 4 different tags out front. I've looked into trying to do this with a new driver I register via: Capybara.register_driver :all_browsers do |app| # What would even work in here

Capybara matcher for presence of button or link

微笑、不失礼 提交于 2019-12-20 10:21:31
问题 Users on web page don't distinguish between "button" and "link styled as button". Is there a way to add check whether a "button or link" is present on page? For example Capybara has step: page.should have_button('Click me') which does not find links styled as buttons. 回答1: Updated answer (should matcher is deprecated in RSpec 3.0+): expect(page).to have_selector(:link_or_button, 'Click me') Before: page.should have_selector(:link_or_button, 'Click me') Followed from click_link_or_button which

Where/how to include helper methods for capybara integration tests

早过忘川 提交于 2019-12-20 09:45:27
问题 I"m using capybara for my integration/acceptance tests. They're in /spec/requests/ folder. Now I have a few helper methods that I use during acceptance tests. One example is register_user which looks like this def register_user(user) visit home_page fill_in 'user_name', :with => user.username fill_in 'password', :with => user.password click_button 'sign_up_button' end I want to use this method in several different acceptance tests (they're in different files). What's the best way to include

How to use Capybara in pure Ruby (without Rails)?

拈花ヽ惹草 提交于 2019-12-20 08:48:15
问题 I'm trying to get Capybara running in a simple Ruby script -- i.e. without/outside of Rails. Here's the script: require 'rubygems' require 'capybara' require 'capybara/dsl' include Capybara Capybara.current_driver = :selenium Capybara.app_host = 'http://www.google.com' visit('/') The problem is that when I run this I get this error: NameError: uninitialized constant Capybara::Session at top level in dsl.rb at line 52 method gem_original_require in custom_require.rb at line 36 method require

How to make Capybara check for visibility after some JS has run?

懵懂的女人 提交于 2019-12-20 08:13:23
问题 After loading a page I have code that runs and hides and shows various items based on data returned by an xhr. My integration test looks something like this: it "should not show the blah" do page.find('#blah').visible?.should be_true end When I manually go to the page in the context this test runs, #blah is not visible as I expect. I suspect that Capybara is looking at the initial state of the page (invisible in this case), evaluating the state of the DOM and failing the test before the JS

How to make Capybara check for visibility after some JS has run?

痞子三分冷 提交于 2019-12-20 08:12:35
问题 After loading a page I have code that runs and hides and shows various items based on data returned by an xhr. My integration test looks something like this: it "should not show the blah" do page.find('#blah').visible?.should be_true end When I manually go to the page in the context this test runs, #blah is not visible as I expect. I suspect that Capybara is looking at the initial state of the page (invisible in this case), evaluating the state of the DOM and failing the test before the JS