forked from KillovSky/Iris
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions.js
More file actions
83 lines (78 loc) · 3.1 KB
/
options.js
File metadata and controls
83 lines (78 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
const fs = require('fs-extra') // Modulo de operações em disco
module.exports = options = (headless, start) => {
/* const chromePath = {
win32: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe', // Windows 32 bit
win64: 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', //Windows 64 bit
linuxChrome: '/usr/bin/google-chrome-stable', // Linux - Chrome
linuxChromium: '/usr/bin/chromium-browser', // Linux - Chromium
darwin: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' // MacOS
} // Define o local do Chrome em todos os sistemas operacionais acima
if (fs.existsSync(chromePath.win32)) {
execPath = chromePath.win32
} else if (fs.existsSync(chromePath.win64)) {
execPath = chromePath.win64
} else if (fs.existsSync(chromePath.linuxChrome)) {
execPath = chromePath.linuxChrome
} else if (fs.existsSync(chromePath.linuxChromium)) {
execPath = chromePath.linuxChromium
} else if (process.platform === 'darwin') {
execPath = chromePath.darwin
} else {
console.error(new Error('Chrome não localizado!'))
process.exit(1)
} // Checa se o navegador existe, se não existir instale Google Chrome*/
// Se quiser usar chrome retire a * / e a / * e entao retire o // do executablePath e useChrome abaixo
const options = {
headless: headless,
autoRefresh: true,
restartOnCrash: start,
cacheEnabled: false,
//executablePath: execPath,
//useChrome: true,
killProcessOnBrowserClose: true,
throwErrorOnTosBlock: false,
chromiumArgs: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--aggressive-cache-discard',
'--disable-cache',
'--disable-application-cache',
'--disable-offline-load-stale-cache',
'--disk-cache-size=0',
'--log-level=3',
'--no-default-browser-check',
'--disable-site-isolation-trials',
'--no-experiments',
'--ignore-gpu-blacklist',
'--ignore-certificate-errors',
'--ignore-certificate-errors-spki-list',
'--disable-gpu',
'--disable-extensions',
'--disable-default-apps',
'--enable-features=NetworkService',
'--disable-setuid-sandbox',
'--no-sandbox',
'--disable-webgl',
'--disable-infobars',
'--window-position=0,0',
'--ignore-certifcate-errors',
'--ignore-certifcate-errors-spki-list',
'--disable-threaded-animation',
'--disable-threaded-scrolling',
'--disable-in-process-stack-traces',
'--disable-histogram-customizer',
'--disable-gl-extensions',
'--disable-composited-antialiasing',
'--disable-canvas-aa',
'--disable-3d-apis',
'--disable-accelerated-2d-canvas',
'--disable-accelerated-jpeg-decoding',
'--disable-accelerated-mjpeg-decode',
'--disable-app-list-dismiss-on-blur',
'--disable-accelerated-video-decode',
'--disable-dev-shm-usage',
'--incognito'
]
} // São as opções de inicialização do Chromium
return options
}