Skip to content

Commit 9be4065

Browse files
committed
fix(selenium): avoid any limited resource issues
1 parent b83d936 commit 9be4065

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

selenium/createDriver.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import { browserSupportsHeadless } from "../lib/getBrowserString.js";
88
// Set script timeout to 10min
99
const DRIVER_SCRIPT_TIMEOUT = 1000 * 60 * 10;
1010

11-
export default async function createDriver( { browserName, headless, url, verbose } ) {
11+
export default async function createDriver( {
12+
browserName,
13+
headless,
14+
url,
15+
verbose
16+
} ) {
1217
const capabilities = Capabilities[ browserName ]();
1318

1419
// Support: IE 11+
@@ -24,6 +29,7 @@ export default async function createDriver( { browserName, headless, url, verbos
2429
const chromeOptions = new Chrome.Options();
2530
chromeOptions.addArguments( "--enable-chrome-browser-cloud-management" );
2631
chromeOptions.addArguments( "--no-sandbox" );
32+
chromeOptions.addArguments( "--disable-dev-shm-usage" );
2733

2834
// Alter the chrome binary path if
2935
// the CHROME_BIN environment variable is set
@@ -46,6 +52,8 @@ export default async function createDriver( { browserName, headless, url, verbos
4652

4753
const edgeOptions = new Edge.Options();
4854
edgeOptions.addArguments( "--enable-chrome-browser-cloud-management" );
55+
edgeOptions.addArguments( "--no-sandbox" );
56+
edgeOptions.addArguments( "--disable-dev-shm-usage" );
4957

5058
// Alter the edge binary path if
5159
// the EDGE_BIN environment variable is set
@@ -58,7 +66,9 @@ export default async function createDriver( { browserName, headless, url, verbos
5866

5967
const ieOptions = new IE.Options();
6068
ieOptions.setEdgeChromium( true );
61-
ieOptions.setEdgePath( "C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe" );
69+
ieOptions.setEdgePath(
70+
"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
71+
);
6272

6373
if ( headless ) {
6474
chromeOptions.addArguments( "--headless=new" );
@@ -72,7 +82,8 @@ export default async function createDriver( { browserName, headless, url, verbos
7282
}
7383
}
7484

75-
const driver = new Builder().withCapabilities( capabilities )
85+
const driver = new Builder()
86+
.withCapabilities( capabilities )
7687
.setChromeOptions( chromeOptions )
7788
.setFirefoxOptions( firefoxOptions )
7889
.setEdgeOptions( edgeOptions )

0 commit comments

Comments
 (0)