简体   繁体   English

尝试使用无头浏览器登录银行帐户

[英]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.在使用无头模式时,您可能想尝试puppeteer-extra ,(Stealth 包)。

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.接下来 - 由于您使用的是无头模式,您可能希望使用它们的选择器或 id 来单击元素,而不是使用鼠标坐标。 page.$() or page.waitForSelector() should suffice. page.$()page.waitForSelector()就足够了。

More about puppeteer-extra-plugin-stealth here .更多关于 puppeteer-extra-plugin-stealth 的信息,请点击此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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