@@ -18,18 +18,6 @@ use tokio::task;
1818
1919use super :: { js:: Statement , Error , Result } ;
2020
21- /// Arguments for Chrome browser.
22- const CHROME_ARGS : & [ & str ] = & [
23- "--use-fake-device-for-media-stream" ,
24- "--use-fake-ui-for-media-stream" ,
25- "--disable-web-security" ,
26- "--disable-dev-shm-usage" ,
27- "--no-sandbox" ,
28- ] ;
29-
30- /// Arguments for Firefox browser.
31- const FIREFOX_ARGS : & [ & str ] = & [ ] ;
32-
3321/// Result returned from all the JS code executed in a browser.
3422#[ derive( Debug , Deserialize ) ]
3523#[ serde( rename_all = "lowercase" ) ]
@@ -337,30 +325,42 @@ pub struct AutoCapabilities {
337325impl AutoCapabilities {
338326 /// Returns `moz:firefoxOptions` for a Firefox browser.
339327 fn firefox ( self ) -> serde_json:: Value {
340- let mut args = FIREFOX_ARGS . to_vec ( ) ;
328+ let mut args = Vec :: new ( ) ;
341329 if self . headless_firefox {
342330 args. push ( "--headless" ) ;
343331 }
344332 json ! ( {
345333 "prefs" : {
346- "media.navigator.streams.fake" : true ,
347334 "media.navigator.permission.disabled" : true ,
348- "media.autoplay.enabled" : true ,
349- "media.autoplay.enabled.user-gestures-needed " : false ,
335+ "media.navigator.streams.fake" : true ,
350336 "media.autoplay.ask-permission" : false ,
351337 "media.autoplay.default" : 0 ,
338+ "media.autoplay.enabled" : true ,
339+ "media.autoplay.enabled.user-gestures-needed" : false ,
352340 } ,
353341 "args" : args,
354342 } )
355343 }
356344
357345 /// Returns `goog:chromeOptions` for a Chrome browser.
358346 fn chrome ( self ) -> serde_json:: Value {
359- let mut args = CHROME_ARGS . to_vec ( ) ;
347+ let mut args = [
348+ "--disable-browser-side-navigation" ,
349+ "--disable-dev-shm-usage" ,
350+ "--disable-extensions" ,
351+ "--disable-gpu" ,
352+ "--disable-web-security" ,
353+ "--dns-prefetch-disable" ,
354+ "--no-sandbox" ,
355+ "--use-fake-device-for-media-stream" ,
356+ "--use-fake-ui-for-media-stream" ,
357+ "--window-size=1920,1080" ,
358+ ]
359+ . to_vec ( ) ;
360360 if self . headless_chrome {
361361 args. push ( "--headless" ) ;
362362 }
363- json ! ( { "args" : args } )
363+ json ! ( { "args" : args} )
364364 }
365365}
366366
0 commit comments