sddsf
This commit is contained in:
@@ -40,7 +40,6 @@ class SeleniumBrowser {
|
||||
|
||||
async request(params) {
|
||||
let uri = params.uri
|
||||
let waitElement = params.waitElement
|
||||
if (this.isRecaptchaReseponseEmpty) {
|
||||
return ''
|
||||
} else {
|
||||
@@ -50,7 +49,7 @@ class SeleniumBrowser {
|
||||
return driver.get(uri)
|
||||
.then(() => driver.findElement(By.css('body')))
|
||||
.then(body => body.getAttribute('innerHTML'))
|
||||
.then(html => this.getHtml(driver, html))
|
||||
.then(html => this.getHtml(driver, html, params))
|
||||
})
|
||||
} else {
|
||||
logger.info('URL %s is not valid', uri)
|
||||
@@ -59,7 +58,7 @@ class SeleniumBrowser {
|
||||
}
|
||||
}
|
||||
|
||||
async getHtml(driver, html) {
|
||||
async getHtml(driver, html, params) {
|
||||
if (html.indexOf('grecaptcha') > -1 || html.indexOf('www.google.com/recaptcha/api2/anchor') > -1) {
|
||||
this.isRecaptchaReseponseEmpty = true
|
||||
let iframeSrc = await driver.findElement(By.css('#grecaptcha iframe')).getAttribute('src')
|
||||
@@ -105,8 +104,14 @@ class SeleniumBrowser {
|
||||
})
|
||||
return ''
|
||||
} else {
|
||||
return driver.get(params.uri)
|
||||
.then(() => driver.wait(until.elementLocated(By.css(params.waitElement))))
|
||||
.then(() => driver.findElement(By.css('body')))
|
||||
.then(body => body.getAttribute('innerHTML'))
|
||||
.then(html => {
|
||||
this.pool.release(driver)
|
||||
return html
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user