diff --git a/src/component/SeleniumBrowser.js b/src/component/SeleniumBrowser.js index 4f36dcb..7cf0ca5 100644 --- a/src/component/SeleniumBrowser.js +++ b/src/component/SeleniumBrowser.js @@ -6,11 +6,11 @@ const logger = require("logops") , { Options } = require('selenium-webdriver/chrome'); class SeleniumBrowser { - constructor() { + constructor() { this.config = { useHub: true, browser: 'chrome' } this.capabilities = Capabilities.chrome() this.sleep = m => new Promise(r => setTimeout(r, m)) - this.isRecaptchaReseponseEmpty = false + this.isRecaptchaReseponseEmpty = false } getDriver() { @@ -43,6 +43,11 @@ class SeleniumBrowser { .then(() => driver.findElement(By.css('body'))) .then(body => body.getAttribute('innerHTML')) .then(html => this.getHtml(html)) + .catch(error => { + return driver.findElement(By.css('body')) + .then(body => body.getAttribute('innerHTML')) + .then(html => this.getHtml(html)) + }) .finally(() => { driver.quit() })