Class: Capybara::Driver::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/capybara/driver/base.rb

Direct Known Subclasses

RackTest::Driver, Selenium::Driver

Instance Method Summary collapse

Instance Method Details

#accept_modal(type, options = {}, &blk) ⇒ String

Execute the block, and then accept the modal opened.

Parameters:

  • type (:alert, :confirm, :prompt)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :wait (Numeric)

    How long to wait for the modal to appear after executing the block.

  • :text (String, Regexp)

    Text to verify is in the message shown in the modal

  • :with (String)

    Text to fill in in the case of a prompt

Returns:

  • (String)

    the message shown in the modal

Raises:



110
111
112
# File 'lib/capybara/driver/base.rb', line 110

def accept_modal(type, options={}, &blk)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#accept_modal'
end

#browser_initialized?Boolean

Deprecated.

This method is being removed

Returns:

  • (Boolean)


143
144
145
146
# File 'lib/capybara/driver/base.rb', line 143

def browser_initialized?
  warn "DEPRECATED: #browser_initialized? is deprecated and will be removed in the next version of Capybara"
  true
end

#close_window(handle) ⇒ Object



75
76
77
# File 'lib/capybara/driver/base.rb', line 75

def close_window(handle)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#close_window'
end

#current_urlObject

Raises:

  • (NotImplementedError)


3
4
5
# File 'lib/capybara/driver/base.rb', line 3

def current_url
  raise NotImplementedError
end

#current_window_handleObject



59
60
61
# File 'lib/capybara/driver/base.rb', line 59

def current_window_handle
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#current_window_handle'
end

#dismiss_modal(type, options = {}, &blk) ⇒ String

Execute the block, and then dismiss the modal opened.

Parameters:

  • type (:alert, :confirm, :prompt)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :wait (Numeric)

    How long to wait for the modal to appear after executing the block.

  • :text (String, Regexp)

    Text to verify is in the message shown in the modal

Returns:

  • (String)

    the message shown in the modal

Raises:



123
124
125
# File 'lib/capybara/driver/base.rb', line 123

def dismiss_modal(type, options={}, &blk)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#dismiss_modal'
end

#evaluate_script(script) ⇒ Object



35
36
37
# File 'lib/capybara/driver/base.rb', line 35

def evaluate_script(script)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#evaluate_script'
end

#execute_script(script) ⇒ Object



31
32
33
# File 'lib/capybara/driver/base.rb', line 31

def execute_script(script)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#execute_script'
end

#find_css(query) ⇒ Object

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/capybara/driver/base.rb', line 15

def find_css(query)
  raise NotImplementedError
end

#find_xpath(query) ⇒ Object

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/capybara/driver/base.rb', line 11

def find_xpath(query)
  raise NotImplementedError
end

#go_backObject



23
24
25
# File 'lib/capybara/driver/base.rb', line 23

def go_back
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#go_back'
end

#go_forwardObject



27
28
29
# File 'lib/capybara/driver/base.rb', line 27

def go_forward
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#go_forward'
end

#htmlObject

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/capybara/driver/base.rb', line 19

def html
  raise NotImplementedError
end

#invalid_element_errorsObject



127
128
129
# File 'lib/capybara/driver/base.rb', line 127

def invalid_element_errors
  []
end

#maximize_window(handle) ⇒ Object



71
72
73
# File 'lib/capybara/driver/base.rb', line 71

def maximize_window(handle)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#maximize_current_window'
end

#needs_server?Boolean

Returns:

  • (Boolean)


138
139
140
# File 'lib/capybara/driver/base.rb', line 138

def needs_server?
  false
end

#no_such_window_errorObject



95
96
97
# File 'lib/capybara/driver/base.rb', line 95

def no_such_window_error
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#no_such_window_error'
end

#open_new_windowObject



83
84
85
# File 'lib/capybara/driver/base.rb', line 83

def open_new_window
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#open_new_window'
end

#reset!Object



135
136
# File 'lib/capybara/driver/base.rb', line 135

def reset!
end

#resize_window_to(handle, width, height) ⇒ Object



67
68
69
# File 'lib/capybara/driver/base.rb', line 67

def resize_window_to(handle, width, height)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#resize_window_to'
end

#response_headersObject



43
44
45
# File 'lib/capybara/driver/base.rb', line 43

def response_headers
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#response_headers'
end

#save_screenshot(path, options = {}) ⇒ Object



39
40
41
# File 'lib/capybara/driver/base.rb', line 39

def save_screenshot(path, options={})
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#save_screenshot'
end

#status_codeObject



47
48
49
# File 'lib/capybara/driver/base.rb', line 47

def status_code
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#status_code'
end

#switch_to_frame(frame) ⇒ Object

Parameters:

Raises:



55
56
57
# File 'lib/capybara/driver/base.rb', line 55

def switch_to_frame(frame)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#switch_to_frame'
end

#switch_to_window(handle) ⇒ Object



87
88
89
# File 'lib/capybara/driver/base.rb', line 87

def switch_to_window(handle)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#switch_to_window'
end

#visit(path) ⇒ Object

Raises:

  • (NotImplementedError)


7
8
9
# File 'lib/capybara/driver/base.rb', line 7

def visit(path)
  raise NotImplementedError
end

#wait?Boolean

Returns:

  • (Boolean)


131
132
133
# File 'lib/capybara/driver/base.rb', line 131

def wait?
  false
end

#window_handlesObject



79
80
81
# File 'lib/capybara/driver/base.rb', line 79

def window_handles
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#window_handles'
end

#window_size(handle) ⇒ Object



63
64
65
# File 'lib/capybara/driver/base.rb', line 63

def window_size(handle)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#window_size'
end

#within_window(locator) ⇒ Object



91
92
93
# File 'lib/capybara/driver/base.rb', line 91

def within_window(locator)
  raise Capybara::NotSupportedByDriverError, 'Capybara::Driver::Base#within_window'
end