sdfdf
This commit is contained in:
@@ -15,16 +15,16 @@ class SeleniumBrowser {
|
||||
this.capabilities = Capabilities.chrome()
|
||||
this.sleep = m => new Promise(r => setTimeout(r, m))
|
||||
this.isRecaptchaReseponseEmpty = false
|
||||
this.pool = pool.createPool({
|
||||
create: () => {
|
||||
return this.getDriver();
|
||||
},
|
||||
destroy: function (driver) {
|
||||
driver.quit();
|
||||
}
|
||||
}, {
|
||||
max: 10, min: 1
|
||||
});
|
||||
// this.pool = pool.createPool({
|
||||
// create: () => {
|
||||
// return this.getDriver();
|
||||
// },
|
||||
// destroy: function (driver) {
|
||||
// driver.quit();
|
||||
// }
|
||||
// }, {
|
||||
// max: 10, min: 1
|
||||
// });
|
||||
}
|
||||
|
||||
getDriver() {
|
||||
@@ -45,7 +45,7 @@ class SeleniumBrowser {
|
||||
} else {
|
||||
logger.info('URL %s', uri)
|
||||
if (uri.indexOf('://') > 3) {
|
||||
return this.pool.acquire().then(driver => {
|
||||
return this.getDriver().then(driver => {
|
||||
return driver.get(uri)
|
||||
.then(() => driver.findElement(By.css('body')))
|
||||
.then(body => body.getAttribute('innerHTML'))
|
||||
@@ -86,7 +86,7 @@ class SeleniumBrowser {
|
||||
if (maxRetry == 0) break
|
||||
} while (res.request == 'CAPCHA_NOT_READY')
|
||||
this.isRecaptchaReseponseEmpty = false
|
||||
this.pool.release(driver)
|
||||
//this.pool.release(driver)
|
||||
return res
|
||||
}).then(res => {
|
||||
logger.debug(res, '2captcha solved')
|
||||
@@ -100,7 +100,7 @@ class SeleniumBrowser {
|
||||
})
|
||||
}).catch(error => {
|
||||
logger.error({ message: error.message }, 'Error occured while process with 2captcha')
|
||||
this.pool.release(driver)
|
||||
//this.pool.release(driver)
|
||||
})
|
||||
return ''
|
||||
} else {
|
||||
@@ -110,7 +110,7 @@ class SeleniumBrowser {
|
||||
.then(() => driver.findElement(By.css('body')))
|
||||
.then(body => body.getAttribute('innerHTML'))
|
||||
.then(html => {
|
||||
this.pool.release(driver)
|
||||
//this.pool.release(driver)
|
||||
return html
|
||||
})
|
||||
} else {
|
||||
@@ -132,9 +132,9 @@ class SeleniumBrowser {
|
||||
}
|
||||
|
||||
async close() {
|
||||
this.pool.drain().then(function () {
|
||||
this.pool.clear();
|
||||
});
|
||||
// this.pool.drain().then(function () {
|
||||
// this.pool.clear();
|
||||
// });
|
||||
}
|
||||
|
||||
loggingChrome() {
|
||||
|
||||
Reference in New Issue
Block a user