Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
const puppeteer = require('puppeteer');
let page;
async function getBrowserPage() {
// Launch headless Chrome. Turn off sandbox so Chrome can run under root.
const browser = await puppeteer.launch({ args: ['--no-sandbox'] });
return browser.newPage();
}
exports.updateMoneyForward = async (req, res) => {
const url = "https://moneyforward.com/users/sign_in";
const mail = "メールアドレス";
const pw = "パスワード";
if (!page) {
page = await getBrowserPage();
}
await page.goto(url);
if((await page.title()) == 'ログイン|マネーフォワード ME'){
await page.focus('input[name="sign_in_session_service[email]"]');
await page.type('input[name="sign_in_session_service[email]"]',mail);
await page.focus('input[name="sign_in_session_service[password]"]');
await page.type('input[name="sign_in_session_service[password]"]',pw);
await page.click('#login-btn-sumit');
await page.waitFor(1000);
}
 await page.click('a[href="/aggregation_queue"]');
res.send('update終了');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment