From 1f88616cf5f8ea7805f656e3e09dc825360f4494 Mon Sep 17 00:00:00 2001 From: spiduler Date: Sun, 25 Oct 2020 03:59:46 +0900 Subject: [PATCH] dsfsdf --- src/component/SeleniumBrowser.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/component/SeleniumBrowser.js b/src/component/SeleniumBrowser.js index 73c2d80..6ac645f 100644 --- a/src/component/SeleniumBrowser.js +++ b/src/component/SeleniumBrowser.js @@ -16,7 +16,7 @@ class SeleniumBrowser { this.capabilities = Capabilities.chrome() this.sleep = m => new Promise(r => setTimeout(r, m)) this.createPool() - setInterval(() => this.reCreatePool(), 1000 * 60 * 3) + // setInterval(() => this.reCreatePool(), 1000 * 60 * 3) } reCreatePool() { @@ -92,20 +92,20 @@ class SeleniumBrowser { let uri = params.uri logger.info('URL %s', uri) if (uri.indexOf('://') > 3) { - if (this.pool) { - 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.destroy(driver) - return html - }) - }else { - throw new Error('Pool is not ready') - } + // if (this.pool) { + 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.destroy(driver) + return html + }) + // }else { + // throw new Error('Pool is not ready') + // } } else { throw new Error('Invalid URI - ' + uri) }