@@ -88,14 +88,24 @@ def app_server
8888 end
8989
9090 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+
91101 @remote_server ||= Selenium ::Server . new (
92102 remote_server_jar ,
93103 java : bazel_java ,
94104 port : random_port ,
95105 log_level : WebDriver . logger . debug? && 'FINE' ,
96106 background : true ,
97107 timeout : 60 ,
98- args : %w[ --selenium-manager true --enable-managed-downloads true ]
108+ args : args
99109 )
100110 end
101111
@@ -105,6 +115,10 @@ def bazel_java
105115 File . expand_path ( File . read ( File . expand_path ( ENV . fetch ( 'WD_BAZEL_JAVA_LOCATION' ) ) ) . chomp )
106116 end
107117
118+ def rbe?
119+ Dir . pwd . start_with? ( '/mnt/engflow' )
120+ end
121+
108122 def reset_remote_server
109123 @remote_server &.stop
110124 @remote_server = nil
@@ -191,7 +205,8 @@ def current_env
191205 driver : driver ,
192206 version : driver_instance . capabilities . browser_version ,
193207 platform : Platform . os ,
194- ci : Platform . ci
208+ ci : Platform . ci ,
209+ rbe : rbe?
195210 }
196211 end
197212
@@ -255,7 +270,7 @@ def chrome_options(args: [], **opts)
255270 opts [ :web_socket_url ] = true if ENV [ 'WEBDRIVER_BIDI' ] && !opts . key? ( :web_socket_url )
256271 opts [ :binary ] ||= ENV [ 'CHROME_BINARY' ] if ENV . key? ( 'CHROME_BINARY' )
257272 args << '--headless=chrome' if ENV [ 'HEADLESS' ]
258- args << '--no-sandbox' if ENV [ 'NO_SANDBOX' ]
273+ args << '--no-sandbox' unless Platform . windows?
259274 args << '--disable-gpu'
260275 WebDriver ::Options . chrome ( args : args , **opts )
261276 end
@@ -265,7 +280,7 @@ def edge_options(args: [], **opts)
265280 opts [ :web_socket_url ] = true if ENV [ 'WEBDRIVER_BIDI' ] && !opts . key? ( :web_socket_url )
266281 opts [ :binary ] ||= ENV [ 'EDGE_BINARY' ] if ENV . key? ( 'EDGE_BINARY' )
267282 args << '--headless=chrome' if ENV [ 'HEADLESS' ]
268- args << '--no-sandbox' if ENV [ 'NO_SANDBOX' ]
283+ args << '--no-sandbox' unless Platform . windows?
269284 args << '--disable-gpu'
270285 WebDriver ::Options . edge ( args : args , **opts )
271286 end
0 commit comments