This commit is contained in:
brow3c
2021-05-16 01:17:30 +09:00
parent 5806d4daaf
commit ec4f2a0bce

View File

@@ -9,6 +9,7 @@ class NavigateService {
this.config = {
browser: 'chrome',
hub: 'http://spiduler-chrome:4444/wd/hub',
capabilities: Capabilities.chrome(),
browserArgs: ['--no-sandbox', '--headless', '--disable-dev-shm-usage']
}
}
@@ -41,17 +42,16 @@ class NavigateService {
}
_getDriverExists(params) {
return new WebDriver(new Session(params.sessionId), new _http.Executor(Promise.resolve(this.config.hub)
return new WebDriver(new Session(params.sessionId, this.config.capabilities), new _http.Executor(Promise.resolve(this.config.hub)
.then(url => new _http.HttpClient(url, null, null))))
}
_getNewDriver() {
let capabilities = Capabilities.chrome()
let opts = new Options;
opts.addArguments(this.config.browserArgs)
return new Builder()
.usingServer(this.config.hub)
.withCapabilities(capabilities)
.withCapabilities(this.config.capabilities)
.forBrowser(this.config.browser)
.setChromeOptions(opts)
.build();