fsdf
This commit is contained in:
@@ -92,16 +92,20 @@ 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.destroy(driver)
|
||||
return html
|
||||
})
|
||||
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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user