dsfdsf
This commit is contained in:
4
index.js
4
index.js
@@ -65,7 +65,9 @@ process.on('SIGTERM', exitHandler.bind(null, { cleanup: true }));
|
||||
* request handler
|
||||
*/
|
||||
app.post('/', async (req, res, next) => {
|
||||
browser.get(req.body).then(html => res.send(html)).catch(e => {
|
||||
browser.get(req.body).then(result => {
|
||||
typeof html == 'string' ? res.send(result) : res.json(result)
|
||||
}).catch(e => {
|
||||
logger.error({ message: e.message, info: e.info }, 'Browser error')
|
||||
res.status(500).send({ code: 500, message: e.message })
|
||||
})
|
||||
|
||||
@@ -21,7 +21,7 @@ class NavigateService {
|
||||
return this._getDriver(params.sessionId).then(driver => {
|
||||
return driver.get(params.uri).then(() => driver.wait(until.elementLocated(By.css(params.css.password)), 5000)).then(async () => {
|
||||
let username = driver.findElement(By.css(params.css.username))
|
||||
let password = driver.findElement(By.css(params.css.password))
|
||||
let password = driver.findElement(By.css(params.css.password))
|
||||
let submit = driver.findElement(By.css(params.css.submit))
|
||||
username.sendKeys(params.key.username)
|
||||
password.sendKeys(params.key.password)
|
||||
@@ -31,7 +31,7 @@ class NavigateService {
|
||||
// return driver.findElement(By.css('body'))
|
||||
}).then(async body => {
|
||||
// return body.getAttribute('innerHTML')
|
||||
return JSON.stringify({ currentUrl: await driver.getCurrentUrl(), sessionId: await driver.getSession() })
|
||||
return { currentUrl: await driver.getCurrentUrl(), sessionId: await driver.getSession() }
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user