Class: Capybara::Selector

### Home Classes Methods

### In Files

- lib/capybara/selector.rb

### Parent

Object

### Namespace

- CLASS Capybara::Selector::Filter

### Methods

- ::add
- ::all
- ::new
- ::remove
- #call
- #css
- #describe
- #description
- #filter
- #label
- #match
- #match?
- #xpath

### Files

- another_test_file.txt
- test_file.txt

### Class/Module Index

Quicksearch

- Capybara
- Capybara::Ambiguous
- Capybara::CapybaraError
- Capybara::DSL
- Capybara::Driver
- Capybara::Driver::Base
- Capybara::Driver::Node
- Capybara::DriverNotFoundError
- Capybara::ElementNotFound
- Capybara::ExpectationNotMet
- Capybara::Features
- Capybara::FileNotFound
- Capybara::FrozenInTime
- Capybara::Helpers
- Capybara::InfiniteRedirectError
- Capybara::ModalNotFound
- Capybara::Node
- Capybara::Node::Actions
- Capybara::Node::Base
- Capybara::Node::Document
- Capybara::Node::DocumentMatchers
- Capybara::Node::Element
- Capybara::Node::Finders
- Capybara::Node::Matchers
- Capybara::Node::Simple
- Capybara::NotSupportedByDriverError
- Capybara::Queries
- Capybara::Queries::BaseQuery
- Capybara::Queries::TextQuery
- Capybara::Queries::TitleQuery
- Capybara::Query
- Capybara::RSpecMatchers
- Capybara::RSpecMatchers::BecomeClosed
- Capybara::RSpecMatchers::HaveSelector
- Capybara::RSpecMatchers::HaveText
- Capybara::RSpecMatchers::HaveTitle
- Capybara::RSpecMatchers::Matcher
- Capybara::RackTest
- Capybara::RackTest::Browser
- Capybara::RackTest::CSSHandlers
- Capybara::RackTest::Driver
- Capybara::RackTest::Form
- Capybara::RackTest::Form::NilUploadedFile
- Capybara::RackTest::Node
- Capybara::ReadOnlyElementError
- Capybara::Result
- Capybara::ScopeError
- Capybara::Selector
- Capybara::Selector::Filter
- Capybara::Selenium
- Capybara::Selenium::Driver
- Capybara::Selenium::Node
- Capybara::Server
- Capybara::Server::Middleware
- Capybara::Session
- Capybara::SpecHelper
- Capybara::UnselectNotAllowed
- Capybara::Window
- Capybara::WindowError
- TestApp
- TestApp::TestAppError
- Object

No matching classes.

# Capybara::Selector

### Attributes

custom_filters[R]
format[R]
name[R]

### Public Class Methods

add(name, &block) click to toggle source

    # File lib/capybara/selector.rb, line 34
    def add(name, &block)
      all[name.to_sym] = Capybara::Selector.new(name.to_sym, &block)
    end

all() click to toggle source

    # File lib/capybara/selector.rb, line 30
    def all
      @selectors ||= {}
    end

new(name, &block) click to toggle source

    # File lib/capybara/selector.rb, line 43
    def initialize(name, &block)
      @name = name
      @custom_filters = {}
      @match = nil
      @label = nil
      @failure_message = nil
      @description = nil
      instance_eval(&block)
    end

remove(name) click to toggle source

    # File lib/capybara/selector.rb, line 38
    def remove(name)
      all.delete(name.to_sym)
    end

### Public Instance Methods

call(locator) click to toggle source

    # File lib/capybara/selector.rb, line 80
    def call(locator)
      if @format==:css
        @css.call(locator)
      else
        @xpath.call(locator)
      end
    end

css(&block) click to toggle source

Same as xpath, but wrap in XPath.css().

    # File lib/capybara/selector.rb, line 60
    def css(&block)
      @format = :css
      @css = block if block
      @css
    end

describe(&block) click to toggle source

    # File lib/capybara/selector.rb, line 96
    def describe &block
      @description = block
    end

description(options={}) click to toggle source

    # File lib/capybara/selector.rb, line 76
    def description(options={})
      (@description && @description.call(options)).to_s
    end

filter(name, options={}, &block) click to toggle source

    # File lib/capybara/selector.rb, line 92
    def filter(name, options={}, &block)
      @custom_filters[name] = Filter.new(name, block, options)
    end

label(label=nil) click to toggle source

    # File lib/capybara/selector.rb, line 71
    def label(label=nil)
      @label = label if label
      @label
    end

match(&block) click to toggle source

    # File lib/capybara/selector.rb, line 66
    def match(&block)
      @match = block if block
      @match
    end

match?(locator) click to toggle source

    # File lib/capybara/selector.rb, line 88
    def match?(locator)
      @match and @match.call(locator)
    end

xpath(&block) click to toggle source

    # File lib/capybara/selector.rb, line 53
    def xpath(&block)
      @format = :xpath
      @xpath = block if block
      @xpath
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.