sdfdsf
This commit is contained in:
@@ -8,7 +8,10 @@ const logger = require("logops")
|
||||
|
||||
class SeleniumBrowser {
|
||||
constructor() {
|
||||
this.config = { useHub: true, browser: 'chrome' }
|
||||
this.config = {
|
||||
useHub: true, browser: 'chrome',
|
||||
browserArgs: ['--no-sandbox', '--headless', '--disable-dev-shm-usage', '--proxy-server=spiduler-tor:8118']
|
||||
}
|
||||
this.capabilities = Capabilities.chrome()
|
||||
this.sleep = m => new Promise(r => setTimeout(r, m))
|
||||
this.isRecaptchaReseponseEmpty = false
|
||||
@@ -16,11 +19,10 @@ class SeleniumBrowser {
|
||||
|
||||
getDriver() {
|
||||
let opts = new Options;
|
||||
opts.addArguments(this.getChromeArgs())
|
||||
opts.addArguments(this.config.browserArgs)
|
||||
return new Builder()
|
||||
.usingServer('http://spiduler-chrome:4444/wd/hub')
|
||||
.withCapabilities(this.capabilities)
|
||||
.setProxy(proxy.manual({http: 'spiduler-tor:8118'}))
|
||||
.forBrowser(this.config.browser)
|
||||
.setChromeOptions(opts)
|
||||
.build();
|
||||
@@ -116,17 +118,6 @@ class SeleniumBrowser {
|
||||
});
|
||||
}
|
||||
|
||||
getChromeArgs() {
|
||||
let args = ['--no-sandbox', '--headless', '--disable-dev-shm-usage']
|
||||
if (config.proxy) {
|
||||
args.push('--proxy-server=' + config.proxy)
|
||||
}
|
||||
if (config.chrome) {
|
||||
config.chrome.split(' ').map(a => args.push('--' + a))
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
loggingChrome() {
|
||||
let logPath = __dirname + '/storage/chrome-logs.txt'
|
||||
logger.info('Chrome logging into %s', logPath)
|
||||
|
||||
Reference in New Issue
Block a user