This commit is contained in:
brow3c
2021-05-16 01:33:34 +09:00
parent 01d6592937
commit 0427a9d94a

View File

@@ -18,6 +18,10 @@ class NavigateService {
return this[params.anchor](params)
}
page(params) {
return this._getDriver(params).then(driver => driver.findElement(By.css('body')).then(body => body.getAttribute('innerHTML')))
}
login(params) {
return this._getDriver(params).then(driver => {
return driver.get(params.uri).then(() => driver.wait(until.elementLocated(By.css(params.css.password)), 5000)).then(async () => {
@@ -38,11 +42,11 @@ class NavigateService {
}
_getDriver(params) {
return params.sessionId ? this._getDriverExists(params).catch(err => this._getNewDriver()) : this._getNewDriver()
return params.sessionId ? this._getDriverExists(params) : this._getNewDriver()
}
async _getDriverExists(params) {
return new WebDriver(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))))
}