From 6e180779e49c9da7d3d13bd643b0b3592e204870 Mon Sep 17 00:00:00 2001 From: spiduler Date: Thu, 22 Oct 2020 13:32:07 +0900 Subject: [PATCH] sdfdf --- src/component/SeleniumBrowser.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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) }