This commit is contained in:
spiduler
2020-10-23 00:59:22 +09:00
parent 0aa1495e30
commit c513c125b5

View File

@@ -42,7 +42,7 @@ class SeleniumBrowser {
logger.info('URL %s', uri)
if (uri.indexOf('://') > 3) {
return this.pool.acquire()
// return this.getDriver()
// return this.getDriver()
.then(async driver => {
let html = await driver.get(uri)
.then(() => driver.findElement(By.css('body')))
@@ -66,9 +66,9 @@ class SeleniumBrowser {
}
getHtml(driver, html, params) {
if (params.waitElement) {
if (params.waitElements) {
return driver.get(params.uri)
.then(() => driver.wait(until.elementLocated(By.css(params.waitElement))))
.then(() => Promise.all(params.waitElements.map(s => driver.wait(until.elementLocated(By.css(s))))))
.then(() => driver.findElement(By.css('body')))
.then(body => body.getAttribute('innerHTML'))
.then(html => {