Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

use irb to find page elements? #5

Open
simi823 opened this issue Jan 8, 2015 · 1 comment
Open

use irb to find page elements? #5

simi823 opened this issue Jan 8, 2015 · 1 comment

Comments

@simi823
Copy link

simi823 commented Jan 8, 2015

can i run an irb console and query for web page elements?

@DylanLacey
Copy link
Contributor

I'm not sure about irb, but you totally can with pry, a nice irb alternative. If you add gem "pry" to your gemfile (And bundle update and all that good stuff) you could create an additional step definition file (called here debug.rb):

# in features/step_definitions/debug.rb
When /I debug/ do
  require "pry"
  binding.pry
end

Then, when you include I Debug in a scenario:

Feature:  Navigating somewhere

  @sauce
  Scenario: Going to rubygems.org
    When I debug

And run your tests using bundle exec cucumber, you'll be dropped into a Pry console 'inside' the debug step definition. Which means that any additional methods or World setup you've done will be available.

All the Capybara methods will be available, including the page object (Which most of the other methods are delegated too). If this is the first line in the Scenario, and so there isn't a Sauce session created yet, the first Capybara DSL method you call will create one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants