简体   繁体   中英

trying to sign into a bank account with headless browser

I'm trying to use a puppeteer to access my bank in this scenario capital one. Although when I try I get "There was an issue accessing your account, please try again, if you continue to see this message, give us a call so we can help." I'm not too surprised that they don't appreciate me trying to log in with a headless browser.

this is the code I'm using

async function credit(creditcost) {

    const browser = await puppeteer.launch();
    const page = await browser.newPage();
    await page.goto('https://www.capitalone.com/');
    await page.mouse.click(167, 121, {button: 'left'})
    await page.keyboard.type('username')
    await page.mouse.click(431, 123, {button: 'left'})
    await page.keyboard.type('password')
    await page.mouse.click(672, 121, {button: 'left'})
    await delay(5000);
    
    
    await page.screenshot({ path: './test/example.png' });
    await browser.close();
  }

Is there any way to get around this issue, or a possibly better option? I'm trying to get balances and transfer funds.

I'm not sure if that is the smartest/safest way to do this, but remember to make sure that your credentials are safe. The first thing is that the website does probably detect the headless browser.

You may want to try puppeteer-extra , (the Stealth package) when using headless mode.

Next thing - since you're using headless mode, you may want to click the elements using their selectors or id's instead of using mouse coordinates. page.$() or page.waitForSelector() should suffice.

More about puppeteer-extra-plugin-stealth here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM