class Capybara::Mechanize::Browser

Attributes

agent[R]
errored_remote_response[R]

Public Class Methods

new(driver) click to toggle source
# File lib/capybara/mechanize/browser.rb, line 12
def initialize(driver)
  @agent = ::Mechanize.new
  @agent.redirect_ok = false
  @agent.user_agent = default_user_agent
  super
end

Public Instance Methods

current_url() click to toggle source
# File lib/capybara/mechanize/browser.rb, line 26
def current_url
  last_request_remote? ? remote_response.current_url : super
end
find(format, selector) click to toggle source
# File lib/capybara/mechanize/browser.rb, line 67
def find(format, selector)
  if format==:css
    dom.css(selector, Capybara::RackTest::CSSHandlers.new)
  else
    dom.xpath(selector)
  end.map { |node| Capybara::Mechanize::Node.new(self, node) }
end
last_response() click to toggle source
# File lib/capybara/mechanize/browser.rb, line 30
def last_response
  last_request_remote? ? remote_response : super
end
remote?(url) click to toggle source
# File lib/capybara/mechanize/browser.rb, line 53
def remote?(url)
  if Capybara.app_host
    true
  else
    host = URI.parse(url).host

    if host.nil?
      last_request_remote?
    else
      !Capybara::Mechanize.local_hosts.include?(host)
    end
  end
end
reset_host!() click to toggle source
# File lib/capybara/mechanize/browser.rb, line 19
def reset_host!
  @last_remote_uri = nil
  @last_request_remote = nil
  @errored_remote_response = nil
  super
end