Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/rb/lib/selenium/webdriver/remote/bridge/commands.rb
1990 views
1
# frozen_string_literal: true
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 WebDriver
22
module Remote
23
#
24
# https://w3c.github.io/webdriver/#endpoints
25
# @api private
26
#
27
28
class Bridge
29
COMMANDS = {
30
status: [:get, 'status'],
31
32
#
33
# session handling
34
#
35
36
new_session: [:post, 'session'],
37
delete_session: [:delete, 'session/:session_id'],
38
39
#
40
# basic driver
41
#
42
43
get: [:post, 'session/:session_id/url'],
44
get_current_url: [:get, 'session/:session_id/url'],
45
back: [:post, 'session/:session_id/back'],
46
forward: [:post, 'session/:session_id/forward'],
47
refresh: [:post, 'session/:session_id/refresh'],
48
get_title: [:get, 'session/:session_id/title'],
49
50
#
51
# window and Frame handling
52
#
53
54
get_window_handle: [:get, 'session/:session_id/window'],
55
new_window: [:post, 'session/:session_id/window/new'],
56
close_window: [:delete, 'session/:session_id/window'],
57
switch_to_window: [:post, 'session/:session_id/window'],
58
get_window_handles: [:get, 'session/:session_id/window/handles'],
59
fullscreen_window: [:post, 'session/:session_id/window/fullscreen'],
60
minimize_window: [:post, 'session/:session_id/window/minimize'],
61
maximize_window: [:post, 'session/:session_id/window/maximize'],
62
set_window_rect: [:post, 'session/:session_id/window/rect'],
63
get_window_rect: [:get, 'session/:session_id/window/rect'],
64
switch_to_frame: [:post, 'session/:session_id/frame'],
65
switch_to_parent_frame: [:post, 'session/:session_id/frame/parent'],
66
67
#
68
# element
69
#
70
71
find_element: [:post, 'session/:session_id/element'],
72
find_elements: [:post, 'session/:session_id/elements'],
73
find_child_element: [:post, 'session/:session_id/element/:id/element'],
74
find_child_elements: [:post, 'session/:session_id/element/:id/elements'],
75
find_shadow_child_element: [:post, 'session/:session_id/shadow/:id/element'],
76
find_shadow_child_elements: [:post, 'session/:session_id/shadow/:id/elements'],
77
get_active_element: [:get, 'session/:session_id/element/active'],
78
get_element_shadow_root: [:get, 'session/:session_id/element/:id/shadow'],
79
is_element_selected: [:get, 'session/:session_id/element/:id/selected'],
80
get_element_attribute: [:get, 'session/:session_id/element/:id/attribute/:name'],
81
get_element_property: [:get, 'session/:session_id/element/:id/property/:name'],
82
get_element_css_value: [:get, 'session/:session_id/element/:id/css/:property_name'],
83
get_element_aria_role: [:get, 'session/:session_id/element/:id/computedrole'],
84
get_element_aria_label: [:get, 'session/:session_id/element/:id/computedlabel'],
85
get_element_text: [:get, 'session/:session_id/element/:id/text'],
86
get_element_tag_name: [:get, 'session/:session_id/element/:id/name'],
87
get_element_rect: [:get, 'session/:session_id/element/:id/rect'],
88
is_element_enabled: [:get, 'session/:session_id/element/:id/enabled'],
89
90
#
91
# document handling
92
#
93
94
get_page_source: [:get, 'session/:session_id/source'],
95
execute_script: [:post, 'session/:session_id/execute/sync'],
96
execute_async_script: [:post, 'session/:session_id/execute/async'],
97
98
#
99
# cookies
100
#
101
102
get_all_cookies: [:get, 'session/:session_id/cookie'],
103
get_cookie: [:get, 'session/:session_id/cookie/:name'],
104
add_cookie: [:post, 'session/:session_id/cookie'],
105
delete_cookie: [:delete, 'session/:session_id/cookie/:name'],
106
delete_all_cookies: [:delete, 'session/:session_id/cookie'],
107
108
#
109
# timeouts
110
#
111
112
get_timeouts: [:get, 'session/:session_id/timeouts'],
113
set_timeout: [:post, 'session/:session_id/timeouts'],
114
115
#
116
# actions
117
#
118
119
actions: [:post, 'session/:session_id/actions'],
120
release_actions: [:delete, 'session/:session_id/actions'],
121
print_page: [:post, 'session/:session_id/print'],
122
123
#
124
# Element Operations
125
#
126
127
element_click: [:post, 'session/:session_id/element/:id/click'],
128
element_clear: [:post, 'session/:session_id/element/:id/clear'],
129
element_send_keys: [:post, 'session/:session_id/element/:id/value'],
130
131
#
132
# alerts
133
#
134
135
dismiss_alert: [:post, 'session/:session_id/alert/dismiss'],
136
accept_alert: [:post, 'session/:session_id/alert/accept'],
137
get_alert_text: [:get, 'session/:session_id/alert/text'],
138
send_alert_text: [:post, 'session/:session_id/alert/text'],
139
140
#
141
# screenshot
142
#
143
144
take_screenshot: [:get, 'session/:session_id/screenshot'],
145
take_element_screenshot: [:get, 'session/:session_id/element/:id/screenshot'],
146
147
#
148
# virtual-authenticator
149
#
150
151
add_virtual_authenticator: [:post, 'session/:session_id/webauthn/authenticator'],
152
remove_virtual_authenticator: [:delete, 'session/:session_id/webauthn/authenticator/:authenticatorId'],
153
add_credential: [:post, 'session/:session_id/webauthn/authenticator/:authenticatorId/credential'],
154
get_credentials: [:get, 'session/:session_id/webauthn/authenticator/:authenticatorId/credentials'],
155
remove_credential: [:delete,
156
'session/:session_id/webauthn/authenticator/:authenticatorId/credentials/:credentialId'],
157
remove_all_credentials: [:delete, 'session/:session_id/webauthn/authenticator/:authenticatorId/credentials'],
158
set_user_verified: [:post, 'session/:session_id/webauthn/authenticator/:authenticatorId/uv'],
159
160
#
161
# federated-credential management
162
#
163
164
get_fedcm_title: [:get, 'session/:session_id/fedcm/gettitle'],
165
get_fedcm_dialog_type: [:get, 'session/:session_id/fedcm/getdialogtype'],
166
get_fedcm_account_list: [:get, 'session/:session_id/fedcm/accountlist'],
167
click_fedcm_dialog_button: [:post, 'session/:session_id/fedcm/clickdialogbutton'],
168
cancel_fedcm_dialog: [:post, 'session/:session_id/fedcm/canceldialog'],
169
select_fedcm_account: [:post, 'session/:session_id/fedcm/selectaccount'],
170
set_fedcm_delay: [:post, 'session/:session_id/fedcm/setdelayenabled'],
171
reset_fedcm_cooldown: [:post, 'session/:session_id/fedcm/resetcooldown']
172
}.freeze
173
end # Bridge
174
end # Remote
175
end # WebDriver
176
end # Selenium
177
178