selenium-webdriver 2.53.3 → 3.142.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +665 -8
- data/Gemfile +2 -0
- data/LICENSE +1 -1
- data/README.md +2 -3
- data/lib/selenium/server.rb +76 -73
- data/lib/selenium/webdriver/atoms/getAttribute.js +7 -0
- data/lib/selenium/webdriver/atoms/isDisplayed.js +102 -0
- data/lib/selenium/webdriver/{phantomjs.rb → atoms.rb} +10 -14
- data/lib/selenium/webdriver/chrome/bridge.rb +30 -101
- data/lib/selenium/webdriver/chrome/driver.rb +127 -0
- data/lib/selenium/webdriver/chrome/options.rb +190 -0
- data/lib/selenium/webdriver/chrome/profile.rb +21 -20
- data/lib/selenium/webdriver/chrome/service.rb +26 -93
- data/lib/selenium/webdriver/chrome.rb +15 -6
- data/lib/selenium/webdriver/common/action_builder.rb +52 -58
- data/lib/selenium/webdriver/common/alert.rb +7 -15
- data/lib/selenium/webdriver/common/bridge_helper.rb +18 -22
- data/lib/selenium/webdriver/common/driver.rb +72 -72
- data/lib/selenium/webdriver/common/driver_extensions/downloads_files.rb +45 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_addons.rb +50 -0
- data/lib/selenium/webdriver/common/driver_extensions/{has_input_devices.rb → has_debugger.rb} +11 -27
- data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +6 -10
- data/lib/selenium/webdriver/common/driver_extensions/has_network_conditions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +7 -8
- data/lib/selenium/webdriver/common/driver_extensions/has_permissions.rb +51 -0
- data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +2 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +2 -4
- data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +3 -5
- data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +2 -5
- data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +6 -9
- data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +9 -7
- data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +3 -8
- data/lib/selenium/webdriver/common/element.rb +59 -39
- data/lib/selenium/webdriver/common/error.rb +259 -104
- data/lib/selenium/webdriver/common/file_reaper.rb +6 -14
- data/lib/selenium/webdriver/common/html5/local_storage.rb +8 -10
- data/lib/selenium/webdriver/common/html5/session_storage.rb +8 -10
- data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +8 -16
- data/lib/selenium/webdriver/common/interactions/input_device.rb +54 -0
- data/lib/selenium/webdriver/common/interactions/interaction.rb +53 -0
- data/lib/selenium/webdriver/{safari/browser.rb → common/interactions/interactions.rb} +17 -14
- data/lib/selenium/webdriver/common/interactions/key_actions.rb +145 -0
- data/lib/selenium/webdriver/common/interactions/key_input.rb +66 -0
- data/lib/selenium/webdriver/{android.rb → common/interactions/none_input.rb} +14 -6
- data/lib/selenium/webdriver/common/interactions/pointer_actions.rb +363 -0
- data/lib/selenium/webdriver/common/interactions/pointer_input.rb +139 -0
- data/lib/selenium/webdriver/common/keyboard.rb +10 -14
- data/lib/selenium/webdriver/common/keys.rb +102 -82
- data/lib/selenium/webdriver/common/log_entry.rb +7 -8
- data/lib/selenium/webdriver/common/logger.rb +115 -0
- data/lib/selenium/webdriver/common/logs.rb +4 -6
- data/lib/selenium/webdriver/common/manager.rb +177 -0
- data/lib/selenium/webdriver/common/mouse.rb +12 -14
- data/lib/selenium/webdriver/common/navigation.rb +4 -6
- data/lib/selenium/webdriver/common/options.rb +26 -127
- data/lib/selenium/webdriver/common/platform.rb +75 -101
- data/lib/selenium/webdriver/common/port_prober.rb +7 -19
- data/lib/selenium/webdriver/common/profile_helper.rb +8 -11
- data/lib/selenium/webdriver/common/proxy.rb +68 -74
- data/lib/selenium/webdriver/common/search_context.rb +28 -37
- data/lib/selenium/webdriver/common/service.rb +219 -0
- data/lib/selenium/webdriver/common/socket_lock.rb +15 -16
- data/lib/selenium/webdriver/common/socket_poller.rb +30 -28
- data/lib/selenium/webdriver/common/target_locator.rb +16 -18
- data/lib/selenium/webdriver/common/timeouts.rb +6 -8
- data/lib/selenium/webdriver/common/touch_action_builder.rb +5 -10
- data/lib/selenium/webdriver/common/touch_screen.rb +22 -23
- data/lib/selenium/webdriver/common/w3c_action_builder.rb +212 -0
- data/lib/selenium/webdriver/common/w3c_manager.rb +45 -0
- data/lib/selenium/webdriver/common/wait.rb +17 -16
- data/lib/selenium/webdriver/common/window.rb +50 -17
- data/lib/selenium/webdriver/common/zipper.rb +9 -13
- data/lib/selenium/webdriver/common.rb +21 -7
- data/lib/selenium/webdriver/edge/bridge.rb +34 -63
- data/lib/selenium/webdriver/edge/driver.rb +66 -0
- data/lib/selenium/webdriver/edge/options.rb +80 -0
- data/lib/selenium/webdriver/edge/service.rb +23 -95
- data/lib/selenium/webdriver/edge.rb +13 -13
- data/lib/selenium/webdriver/firefox/binary.rb +45 -60
- data/lib/selenium/webdriver/firefox/driver.rb +50 -0
- data/lib/selenium/webdriver/firefox/extension/prefs.json +3 -12
- data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
- data/lib/selenium/webdriver/firefox/extension.rb +20 -10
- data/lib/selenium/webdriver/firefox/launcher.rb +16 -22
- data/lib/selenium/webdriver/firefox/legacy/driver.rb +83 -0
- data/lib/selenium/webdriver/firefox/marionette/bridge.rb +49 -0
- data/lib/selenium/webdriver/firefox/marionette/driver.rb +90 -0
- data/lib/selenium/webdriver/firefox/options.rb +162 -0
- data/lib/selenium/webdriver/firefox/profile.rb +47 -48
- data/lib/selenium/webdriver/firefox/profiles_ini.rb +11 -18
- data/lib/selenium/webdriver/firefox/service.rb +24 -95
- data/lib/selenium/webdriver/firefox/util.rb +2 -4
- data/lib/selenium/webdriver/firefox.rb +27 -12
- data/lib/selenium/webdriver/ie/driver.rb +85 -0
- data/lib/selenium/webdriver/ie/options.rb +138 -0
- data/lib/selenium/webdriver/ie/service.rb +54 -0
- data/lib/selenium/webdriver/ie.rb +12 -10
- data/lib/selenium/webdriver/remote/bridge.rb +100 -564
- data/lib/selenium/webdriver/remote/capabilities.rb +98 -100
- data/lib/selenium/webdriver/remote/driver.rb +51 -0
- data/lib/selenium/webdriver/remote/http/common.rb +34 -22
- data/lib/selenium/webdriver/remote/http/curb.rb +13 -14
- data/lib/selenium/webdriver/remote/http/default.rb +62 -43
- data/lib/selenium/webdriver/remote/http/persistent.rb +12 -9
- data/lib/selenium/webdriver/remote/oss/bridge.rb +594 -0
- data/lib/selenium/webdriver/remote/oss/commands.rb +223 -0
- data/lib/selenium/webdriver/remote/response.rb +48 -28
- data/lib/selenium/webdriver/remote/server_error.rb +3 -5
- data/lib/selenium/webdriver/remote/w3c/bridge.rb +605 -0
- data/lib/selenium/webdriver/remote/w3c/capabilities.rb +310 -0
- data/lib/selenium/webdriver/remote/w3c/commands.rb +157 -0
- data/lib/selenium/webdriver/remote.rb +10 -16
- data/lib/selenium/webdriver/safari/bridge.rb +17 -101
- data/lib/selenium/webdriver/{firefox/w3c_bridge.rb → safari/driver.rb} +27 -25
- data/lib/selenium/webdriver/safari/options.rb +29 -31
- data/lib/selenium/webdriver/safari/service.rb +38 -0
- data/lib/selenium/webdriver/safari.rb +27 -27
- data/lib/selenium/webdriver/support/abstract_event_listener.rb +19 -4
- data/lib/selenium/webdriver/support/block_event_listener.rb +3 -5
- data/lib/selenium/webdriver/support/color.rb +60 -43
- data/lib/selenium/webdriver/support/escaper.rb +43 -0
- data/lib/selenium/webdriver/support/event_firing_bridge.rb +39 -41
- data/lib/selenium/webdriver/support/select.rb +45 -97
- data/lib/selenium/webdriver/support.rb +3 -2
- data/lib/selenium/webdriver/{iphone.rb → version.rb} +3 -7
- data/lib/selenium/webdriver.rb +36 -23
- data/lib/selenium-webdriver.rb +2 -2
- data/selenium-webdriver.gemspec +42 -29
- metadata +331 -262
- data/lib/selenium/client/base.rb +0 -151
- data/lib/selenium/client/driver.rb +0 -29
- data/lib/selenium/client/errors.rb +0 -28
- data/lib/selenium/client/extensions.rb +0 -132
- data/lib/selenium/client/idiomatic.rb +0 -507
- data/lib/selenium/client/javascript_expression_builder.rb +0 -135
- data/lib/selenium/client/javascript_frameworks/jquery.rb +0 -32
- data/lib/selenium/client/javascript_frameworks/prototype.rb +0 -32
- data/lib/selenium/client/legacy_driver.rb +0 -1722
- data/lib/selenium/client/protocol.rb +0 -123
- data/lib/selenium/client/selenium_helper.rb +0 -49
- data/lib/selenium/client.rb +0 -57
- data/lib/selenium/rake/server_task.rb +0 -176
- data/lib/selenium/webdriver/android/bridge.rb +0 -68
- data/lib/selenium/webdriver/common/core_ext/base64.rb +0 -28
- data/lib/selenium/webdriver/common/core_ext/dir.rb +0 -61
- data/lib/selenium/webdriver/common/html5/location.rb +0 -19
- data/lib/selenium/webdriver/common/w3c_error.rb +0 -194
- data/lib/selenium/webdriver/edge/legacy_support.rb +0 -117
- data/lib/selenium/webdriver/firefox/bridge.rb +0 -89
- data/lib/selenium/webdriver/ie/bridge.rb +0 -88
- data/lib/selenium/webdriver/ie/server.rb +0 -133
- data/lib/selenium/webdriver/iphone/bridge.rb +0 -64
- data/lib/selenium/webdriver/phantomjs/bridge.rb +0 -78
- data/lib/selenium/webdriver/phantomjs/service.rb +0 -130
- data/lib/selenium/webdriver/remote/commands.rb +0 -211
- data/lib/selenium/webdriver/remote/w3c_bridge.rb +0 -668
- data/lib/selenium/webdriver/remote/w3c_capabilities.rb +0 -236
- data/lib/selenium/webdriver/remote/w3c_commands.rb +0 -132
- data/lib/selenium/webdriver/safari/resources/client.js +0 -7255
- data/lib/selenium/webdriver/safari/server.rb +0 -187
- data/lib/selenium-client.rb +0 -21
data/lib/selenium/client/base.rb
DELETED
@@ -1,151 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Selenium
|
21
|
-
module Client
|
22
|
-
|
23
|
-
# Driver constructor and session management commands
|
24
|
-
module Base
|
25
|
-
include Selenium::Client::Protocol
|
26
|
-
include Selenium::Client::GeneratedDriver
|
27
|
-
include Selenium::Client::Extensions
|
28
|
-
include Selenium::Client::Idiomatic
|
29
|
-
|
30
|
-
attr_reader :host, :port, :browser_string, :browser_url,
|
31
|
-
:default_timeout_in_seconds,
|
32
|
-
:default_javascript_framework,
|
33
|
-
:highlight_located_element_by_default
|
34
|
-
|
35
|
-
#
|
36
|
-
# Create a new client driver
|
37
|
-
#
|
38
|
-
# Example:
|
39
|
-
#
|
40
|
-
# Selenium::Client::Driver.new \
|
41
|
-
# :host => "localhost",
|
42
|
-
# :port => 4444,
|
43
|
-
# :browser => "*firefox",
|
44
|
-
# :timeout_in_seconds => 10,
|
45
|
-
# :url => "http://localhost:3000",
|
46
|
-
#
|
47
|
-
# You can also set the default javascript framework used for :wait_for
|
48
|
-
# AJAX and effects semantics (:prototype is the default value):
|
49
|
-
#
|
50
|
-
# Selenium::Client::Driver.new \
|
51
|
-
# :host => "localhost",
|
52
|
-
# :port => 4444,
|
53
|
-
# :browser => "*firefox",
|
54
|
-
# :timeout_in_seconds => 10,
|
55
|
-
# :url => "http://localhost:3000",
|
56
|
-
# :javascript_framework => :jquery
|
57
|
-
#
|
58
|
-
# You can also enables automatic highlighting of located elements
|
59
|
-
# by passing the highlight_located_element option, e.g.
|
60
|
-
#
|
61
|
-
# Selenium::Client::Driver.new \
|
62
|
-
# :host => "localhost",
|
63
|
-
# :port => 4444,
|
64
|
-
# :browser => "*firefox",
|
65
|
-
# :highlight_located_element => true
|
66
|
-
#
|
67
|
-
def initialize(*args)
|
68
|
-
if args[0].kind_of?(Hash)
|
69
|
-
options = args[0]
|
70
|
-
@host = options[:host]
|
71
|
-
@port = options[:port].to_i
|
72
|
-
@browser_string = options[:browser]
|
73
|
-
@browser_url = options[:url]
|
74
|
-
@default_timeout_in_seconds = (options[:timeout_in_seconds] || 300).to_i
|
75
|
-
@default_javascript_framework = options[:javascript_framework] || :prototype
|
76
|
-
@highlight_located_element_by_default = options[:highlight_located_element] || false
|
77
|
-
else
|
78
|
-
@host = args[0]
|
79
|
-
@port = args[1].to_i
|
80
|
-
@browser_string = args[2]
|
81
|
-
@browser_url = args[3]
|
82
|
-
@default_timeout_in_seconds = (args[4] || 300).to_i
|
83
|
-
@default_javascript_framework = :prototype
|
84
|
-
@highlight_located_element_by_default = false
|
85
|
-
end
|
86
|
-
|
87
|
-
@extension_js = ""
|
88
|
-
@session_id = nil
|
89
|
-
end
|
90
|
-
|
91
|
-
def session_started?
|
92
|
-
not @session_id.nil?
|
93
|
-
end
|
94
|
-
|
95
|
-
# Starts a new browser session (launching a new browser matching
|
96
|
-
# configuration provided at driver creation time).
|
97
|
-
#
|
98
|
-
# Browser session specific option can also be provided. e.g.
|
99
|
-
#
|
100
|
-
# driver.start_new_browser_session(:captureNetworkTraffic => true)
|
101
|
-
#
|
102
|
-
def start_new_browser_session(options={})
|
103
|
-
start_args = [@browser_string, @browser_url, @extension_js]
|
104
|
-
|
105
|
-
if driver = options.delete(:driver)
|
106
|
-
expected_browser_string = "*webdriver"
|
107
|
-
unless @browser_string == expected_browser_string
|
108
|
-
raise ArgumentError, "can't use :driver unless the browser string is #{expected_browser_string.inspect} (got #{@browser_string.inspect})"
|
109
|
-
end
|
110
|
-
|
111
|
-
sid = driver.capabilities['webdriver.remote.sessionid']
|
112
|
-
sid or raise ArgumentError, "This driver can not be wrapped in the RC API."
|
113
|
-
|
114
|
-
start_args << "webdriver.remote.sessionid=#{sid}"
|
115
|
-
end
|
116
|
-
|
117
|
-
start_args << options.collect {|key,value| "#{key.to_s}=#{value.to_s}"}.sort.join(";")
|
118
|
-
|
119
|
-
@session_id = string_command "getNewBrowserSession", start_args
|
120
|
-
# Consistent timeout on the remote control and driver side.
|
121
|
-
# Intuitive and this is what you want 90% of the time
|
122
|
-
self.remote_control_timeout_in_seconds = @default_timeout_in_seconds
|
123
|
-
self.highlight_located_element = true if highlight_located_element_by_default
|
124
|
-
end
|
125
|
-
|
126
|
-
def close_current_browser_session
|
127
|
-
remote_control_command "testComplete" if @session_id
|
128
|
-
@session_id = nil
|
129
|
-
end
|
130
|
-
|
131
|
-
def start(opts = {})
|
132
|
-
start_new_browser_session opts
|
133
|
-
end
|
134
|
-
|
135
|
-
def stop
|
136
|
-
close_current_browser_session
|
137
|
-
end
|
138
|
-
|
139
|
-
def chrome_backend?
|
140
|
-
["*chrome", "*firefox", "*firefox2", "*firefox3"].include?(@browser_string)
|
141
|
-
end
|
142
|
-
|
143
|
-
def javascript_extension=(new_javascript_extension)
|
144
|
-
@extension_js = new_javascript_extension
|
145
|
-
end
|
146
|
-
alias :set_extension_js :javascript_extension=
|
147
|
-
|
148
|
-
end
|
149
|
-
|
150
|
-
end
|
151
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Selenium
|
21
|
-
module Client
|
22
|
-
|
23
|
-
# Client driver providing the complete API to drive a Selenium Remote Control
|
24
|
-
class Driver
|
25
|
-
include Selenium::Client::Base
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Selenium
|
21
|
-
module Client
|
22
|
-
class CommandError < RuntimeError
|
23
|
-
end
|
24
|
-
|
25
|
-
class ProtocolError < RuntimeError
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,132 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
#
|
3
|
-
# Licensed to the Software Freedom Conservancy (SFC) under one
|
4
|
-
# or more contributor license agreements. See the NOTICE file
|
5
|
-
# distributed with this work for additional information
|
6
|
-
# regarding copyright ownership. The SFC licenses this file
|
7
|
-
# to you under the Apache License, Version 2.0 (the
|
8
|
-
# "License"); you may not use this file except in compliance
|
9
|
-
# with the License. You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing,
|
14
|
-
# software distributed under the License is distributed on an
|
15
|
-
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
16
|
-
# KIND, either express or implied. See the License for the
|
17
|
-
# specific language governing permissions and limitations
|
18
|
-
# under the License.
|
19
|
-
|
20
|
-
module Selenium
|
21
|
-
module Client
|
22
|
-
|
23
|
-
# Convenience methods not explicitly part of the protocol
|
24
|
-
module Extensions
|
25
|
-
|
26
|
-
# These for all Ajax request to finish (Only works if you are using prototype, the wait happens in the browser)
|
27
|
-
def wait_for_ajax(options={})
|
28
|
-
builder = JavascriptExpressionBuilder.new active_javascript_framework(options)
|
29
|
-
wait_for_condition builder.no_pending_ajax_requests.script, options[:timeout_in_seconds]
|
30
|
-
end
|
31
|
-
|
32
|
-
# Wait for all Prototype effects to be processed (the wait happens in the browser).
|
33
|
-
#
|
34
|
-
# Credits to http://github.com/brynary/webrat/tree/master
|
35
|
-
def wait_for_effects(options={})
|
36
|
-
builder = JavascriptExpressionBuilder.new active_javascript_framework(options)
|
37
|
-
wait_for_condition builder.no_pending_effects.script, options[:timeout_in_seconds]
|
38
|
-
end
|
39
|
-
|
40
|
-
# Wait for an element to be present (the wait happens in the browser).
|
41
|
-
def wait_for_element(locator, options={})
|
42
|
-
builder = JavascriptExpressionBuilder.new
|
43
|
-
builder.find_element(locator).append("element != null;")
|
44
|
-
wait_for_condition builder.script, options[:timeout_in_seconds]
|
45
|
-
end
|
46
|
-
|
47
|
-
# Wait for an element to NOT be present (the wait happens in the browser).
|
48
|
-
def wait_for_no_element(locator, options={})
|
49
|
-
builder = JavascriptExpressionBuilder.new
|
50
|
-
builder.find_element(locator).append("element == null;")
|
51
|
-
wait_for_condition builder.script, options[:timeout_in_seconds]
|
52
|
-
end
|
53
|
-
|
54
|
-
# Wait for some text to be present (the wait is happening browser side).
|
55
|
-
#
|
56
|
-
# wait_for_text will search for the given argument within the innerHTML
|
57
|
-
# of the current DOM. Note that this method treats a single string
|
58
|
-
# as a special case.
|
59
|
-
#
|
60
|
-
# ==== Parameters
|
61
|
-
# wait_for_text accepts an optional hash of parameters:
|
62
|
-
# * <tt>:element</tt> - a selenium locator for an element limiting
|
63
|
-
# the search scope.
|
64
|
-
# * <tt>:timeout_in_seconds</tt> - duration in seconds after which we
|
65
|
-
# time out if text cannot be found.
|
66
|
-
#
|
67
|
-
# ==== Regular Expressions
|
68
|
-
# In addition to plain strings, wait_for_text accepts regular expressions
|
69
|
-
# as the pattern specification.
|
70
|
-
#
|
71
|
-
# ==== Examples
|
72
|
-
# The following are equivalent, and will match "some text" anywhere
|
73
|
-
# within the document:
|
74
|
-
# wait_for_text "some text"
|
75
|
-
# wait_for_text /some text/
|
76
|
-
#
|
77
|
-
# This will match "some text" anywhere within the specified element:
|
78
|
-
# wait_for_text /some text/, :element => "container"
|
79
|
-
#
|
80
|
-
# This will match "some text" only if it exactly matches the complete
|
81
|
-
# innerHTML of the specified element:
|
82
|
-
# wait_for_text "some text", :element => "container"
|
83
|
-
#
|
84
|
-
def wait_for_text(pattern, options={})
|
85
|
-
builder = JavascriptExpressionBuilder.new
|
86
|
-
builder.find_text(pattern, options).append("text_match == true;")
|
87
|
-
wait_for_condition builder.script, options[:timeout_in_seconds]
|
88
|
-
end
|
89
|
-
|
90
|
-
# Wait for some text to NOT be present (the wait happens in the browser).
|
91
|
-
#
|
92
|
-
# See wait_for_text for usage details.
|
93
|
-
def wait_for_no_text(pattern, options={})
|
94
|
-
builder = JavascriptExpressionBuilder.new
|
95
|
-
builder.find_text(pattern, options).append("text_match == false;")
|
96
|
-
wait_for_condition builder.script, options[:timeout_in_seconds]
|
97
|
-
end
|
98
|
-
|
99
|
-
# Wait for a field to get a specific value (the wait happens in the browser).
|
100
|
-
def wait_for_field_value(locator, expected_value, options={})
|
101
|
-
builder = JavascriptExpressionBuilder.new
|
102
|
-
builder.find_element(locator).element_value_is(expected_value)
|
103
|
-
wait_for_condition builder.script, options[:timeout_in_seconds]
|
104
|
-
end
|
105
|
-
|
106
|
-
# Wait for a field to not have a specific value (the wait happens in the browser).
|
107
|
-
def wait_for_no_field_value(locator, expected_value, options={})
|
108
|
-
builder = JavascriptExpressionBuilder.new
|
109
|
-
builder.find_element(locator).element_value_is_not(expected_value)
|
110
|
-
wait_for_condition builder.script, options[:timeout_in_seconds]
|
111
|
-
end
|
112
|
-
|
113
|
-
# Wait for something to be visible (the wait happens in the browser).
|
114
|
-
def wait_for_visible(locator, options={})
|
115
|
-
builder = JavascriptExpressionBuilder.new
|
116
|
-
wait_for_condition builder.visible(locator).script, options[:timeout_in_seconds]
|
117
|
-
end
|
118
|
-
|
119
|
-
# Wait for something to not be visible (the wait happens in the browser).
|
120
|
-
def wait_for_not_visible(locator, options={})
|
121
|
-
builder = JavascriptExpressionBuilder.new
|
122
|
-
wait_for_condition builder.not_visible(locator).script, options[:timeout_in_seconds]
|
123
|
-
end
|
124
|
-
|
125
|
-
def active_javascript_framework(options)
|
126
|
-
options[:javascript_framework] || default_javascript_framework
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
132
|
-
end
|