diff --git a/src/component/SeleniumBrowser.js b/src/component/SeleniumBrowser.js index 14d3f8a..4901a39 100644 --- a/src/component/SeleniumBrowser.js +++ b/src/component/SeleniumBrowser.js @@ -41,15 +41,18 @@ class SeleniumBrowser { let uri = params.uri logger.info('URL %s', uri) if (uri.indexOf('://') > 3) { - return this.pool.acquire().then(async driver => { - let html = await driver.get(uri) - .then(() => driver.findElement(By.css('body'))) - .then(body => body.getAttribute('innerHTML')) - let htmlPromise = this.isCaptchaPage(html) ? this.resolveCaptcha(driver) : this.getHtml(driver, html, params) - html = await htmlPromise - this.pool.release(driver) - return html - }) + // return this.pool.acquire() + return this.getDriver() + .then(async driver => { + let html = await driver.get(uri) + .then(() => driver.findElement(By.css('body'))) + .then(body => body.getAttribute('innerHTML')) + let htmlPromise = this.isCaptchaPage(html) ? this.resolveCaptcha(driver) : this.getHtml(driver, html, params) + html = await htmlPromise + // this.pool.release(driver) + driver.quit() + return html + }) } else { throw new Error('Invalid URI - ' + uri) }