@@ -88,14 +88,24 @@ def app_server
88
88
end
89
89
90
90
def remote_server
91
+ args = if ENV . key? ( 'CHROMEDRIVER_BINARY' )
92
+ [ "-Dwebdriver.chrome.driver=#{ ENV [ 'CHROMEDRIVER_BINARY' ] } " ]
93
+ elsif ENV . key? ( 'MSEDGEDRIVER_BINARY' )
94
+ [ "-Dwebdriver.edge.driver=#{ ENV [ 'MSEDGEDRIVER_BINARY' ] } " ]
95
+ elsif ENV . key? ( 'GECKODRIVER_BINARY' )
96
+ [ "-Dwebdriver.gecko.driver=#{ ENV [ 'GECKODRIVER_BINARY' ] } " ]
97
+ else
98
+ %w[ --selenium-manager true --enable-managed-downloads true ]
99
+ end
100
+
91
101
@remote_server ||= Selenium ::Server . new (
92
102
remote_server_jar ,
93
103
java : bazel_java ,
94
104
port : random_port ,
95
105
log_level : WebDriver . logger . debug? && 'FINE' ,
96
106
background : true ,
97
107
timeout : 60 ,
98
- args : %w[ --selenium-manager true --enable-managed-downloads true ]
108
+ args : args
99
109
)
100
110
end
101
111
@@ -105,6 +115,10 @@ def bazel_java
105
115
File . expand_path ( File . read ( File . expand_path ( ENV . fetch ( 'WD_BAZEL_JAVA_LOCATION' ) ) ) . chomp )
106
116
end
107
117
118
+ def rbe?
119
+ Dir . pwd . start_with? ( '/mnt/engflow' )
120
+ end
121
+
108
122
def reset_remote_server
109
123
@remote_server &.stop
110
124
@remote_server = nil
@@ -191,7 +205,8 @@ def current_env
191
205
driver : driver ,
192
206
version : driver_instance . capabilities . browser_version ,
193
207
platform : Platform . os ,
194
- ci : Platform . ci
208
+ ci : Platform . ci ,
209
+ rbe : rbe?
195
210
}
196
211
end
197
212
@@ -255,7 +270,7 @@ def chrome_options(args: [], **opts)
255
270
opts [ :web_socket_url ] = true if ENV [ 'WEBDRIVER_BIDI' ] && !opts . key? ( :web_socket_url )
256
271
opts [ :binary ] ||= ENV [ 'CHROME_BINARY' ] if ENV . key? ( 'CHROME_BINARY' )
257
272
args << '--headless=chrome' if ENV [ 'HEADLESS' ]
258
- args << '--no-sandbox' if ENV [ 'NO_SANDBOX' ]
273
+ args << '--no-sandbox' unless Platform . windows?
259
274
args << '--disable-gpu'
260
275
WebDriver ::Options . chrome ( args : args , **opts )
261
276
end
@@ -265,7 +280,7 @@ def edge_options(args: [], **opts)
265
280
opts [ :web_socket_url ] = true if ENV [ 'WEBDRIVER_BIDI' ] && !opts . key? ( :web_socket_url )
266
281
opts [ :binary ] ||= ENV [ 'EDGE_BINARY' ] if ENV . key? ( 'EDGE_BINARY' )
267
282
args << '--headless=chrome' if ENV [ 'HEADLESS' ]
268
- args << '--no-sandbox' if ENV [ 'NO_SANDBOX' ]
283
+ args << '--no-sandbox' unless Platform . windows?
269
284
args << '--disable-gpu'
270
285
WebDriver ::Options . edge ( args : args , **opts )
271
286
end
0 commit comments