1+ const fs = require ( 'fs' ) ;
2+ const os = require ( 'os' ) ;
3+ const path = require ( 'path' ) ;
14const Chrome = require ( 'selenium-webdriver/chrome' ) ;
25const { Browser, Builder} = require ( "selenium-webdriver" ) ;
36const { getBinaryPaths} = require ( "selenium-webdriver/common/driverFinder" ) ;
4- const options = new Chrome . Options ( ) ;
57
68describe ( 'Service Test' , function ( ) {
79 it ( 'Default service' , async function ( ) {
@@ -26,7 +28,10 @@ describe('Service Test', function () {
2628 let browserPath = paths . browserPath ;
2729
2830 options . setChromeBinaryPath ( browserPath )
29- options . addArguments ( '--enable-logging' , '--v=1' ) ;
31+ const userDataDir = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'chrome-profile-' ) ) ;
32+ options . addArguments ( `--user-data-dir=${ userDataDir } ` ) ;
33+ options . addArguments ( '--no-sandbox' ) ;
34+ options . addArguments ( '--disable-dev-shm-usage' ) ;
3035
3136 let service = new Chrome . ServiceBuilder ( driverPath )
3237
@@ -38,6 +43,8 @@ describe('Service Test', function () {
3843
3944 await driver . get ( 'https://www.selenium.dev/selenium/web/blank.html' ) ;
4045 await driver . quit ( ) ;
46+ // 👉 Cleanup user data dir
47+ fs . rmSync ( userDataDir , { recursive : true , force : true } ) ;
4148 } ) ;
4249
4350 it ( 'Set port' , async function ( ) {
0 commit comments