File tree Expand file tree Collapse file tree 4 files changed +28
-5
lines changed
rb/lib/selenium/webdriver Expand file tree Collapse file tree 4 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,9 @@ def find_element(*args)
59
59
end
60
60
61
61
bridge . find_element_by by , what . to_s , ref
62
+ rescue Selenium ::WebDriver ::Error ::TimeOutError
63
+ # Implicit Wait times out in Edge
64
+ raise Selenium ::WebDriver ::Error ::NoSuchElementError
62
65
end
63
66
64
67
#
@@ -79,6 +82,9 @@ def find_elements(*args)
79
82
end
80
83
81
84
bridge . find_elements_by by , what . to_s , ref
85
+ rescue Selenium ::WebDriver ::Error ::TimeOutError
86
+ # Implicit Wait times out in Edge
87
+ [ ]
82
88
end
83
89
84
90
private
Original file line number Diff line number Diff line change @@ -63,6 +63,10 @@ def window(id)
63
63
nil
64
64
end
65
65
66
+ unless @bridge . getWindowHandles . include? id
67
+ raise Error ::NoSuchWindowError , "The specified identifier '#{ id } ' is not found in the window handle list"
68
+ end
69
+
66
70
@bridge . switchToWindow id
67
71
68
72
begin
Original file line number Diff line number Diff line change @@ -158,19 +158,23 @@ def getAlert
158
158
end
159
159
160
160
def acceptAlert
161
- execute :acceptAlert
161
+ command = capabilities . browser_name == 'MicrosoftEdge' ? :acceptAlertW3C : :acceptAlert
162
+ execute command
162
163
end
163
164
164
165
def dismissAlert
165
- execute :dismissAlert
166
+ command = capabilities . browser_name == 'MicrosoftEdge' ? :dismissAlertW3C : :dismissAlert
167
+ execute command
166
168
end
167
169
168
170
def setAlertValue ( keys )
169
- execute :setAlertValue , { } , :text => keys . to_s
171
+ command = capabilities . browser_name == 'MicrosoftEdge' ? :setAlertValueW3C : :setAlertValue
172
+ execute command , { } , :text => keys . to_s
170
173
end
171
174
172
175
def getAlertText
173
- execute :getAlertText
176
+ command = capabilities . browser_name == 'MicrosoftEdge' ? :getAlertTextW3C : :getAlertText
177
+ execute command
174
178
end
175
179
176
180
#
@@ -206,7 +210,11 @@ def setVisible(bool)
206
210
end
207
211
208
212
def switchToWindow ( name )
209
- execute :switchToWindow , { } , :name => name
213
+ if capabilities . browser_name == 'MicrosoftEdge'
214
+ execute :switchToWindow , { } , :handle => name
215
+ else
216
+ execute :switchToWindow , { } , :name => name
217
+ end
210
218
end
211
219
212
220
def switchToFrame ( id )
Original file line number Diff line number Diff line change @@ -78,6 +78,11 @@ class Selenium::WebDriver::Remote::Bridge
78
78
command :getAlertText , :get , "session/:session_id/alert_text"
79
79
command :setAlertValue , :post , "session/:session_id/alert_text"
80
80
81
+ command :dismissAlertW3C , :post , "session/:session_id/alert/dismiss"
82
+ command :acceptAlertW3C , :post , "session/:session_id/alert/accept"
83
+ command :getAlertTextW3C , :get , "session/:session_id/alert/text"
84
+ command :setAlertValueW3C , :post , "session/:session_id/alert/text"
85
+
81
86
#
82
87
# target locator
83
88
#
You can’t perform that action at this time.
0 commit comments