Skip to content

Username field error: Error: No element found for selector: button[type='submit'] #2

Open

Description

@Lekebabiste

Here's my code

import SnapBot from "./snapbot.js";


const bot = new SnapBot();

let credentials = {
  username: "myUsername",
  password: "myPassword",
};

await bot.launchSnapchat({
  headless: false,
  userDataDir: "C:\\Users\\yourname\\AppData\\Local\\Google\\Chrome\\User Data\\Default",
  args: [
    "--start-maximized",
    "--force-device-scale-factor=1",
    "--use-fake-ui-for-media-stream",
    "--allow-file-access-from-files",
    "--enable-media-stream",
  ],
});



await bot.login(credentials);


const logged = await bot.isLogged()  //returns a boolean
  if (!logged) {
    await bot.login(credentials);
  } else {
    console.log("bot is already logged");
  }



const recipients = await bot.listRecipients();
console.log(recipients);

And I got this error in the terminal :
`➜ SnapBot git:(main) ✗ npm run bot

snapbot@1.0.0 bot
node index.js

Username field error: Error: No element found for selector: button[type='submit']
at assert (/home/selofaney/Documents/flamebot/SnapBot/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:18:15)
at CdpFrame.click (/home/selofaney/Documents/flamebot/SnapBot/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Frame.js:755:40)
at async SnapBot.login (file:///home/selofaney/Documents/flamebot/SnapBot/snapbot.js:113:7)
at async file:///home/selofaney/Documents/flamebot/SnapBot/index.js:25:1
Waiting for password field...
`
I'm using Arch Linux

Activity

  1. 0xF9M commented on Dec 24, 2025

    @0xF9M

    Try using the Enter key as a fallback

    const submitBtn = await this.page.$('button[type="submit"]');
    if (submitBtn) {
      await submitBtn.click();
      console.log("Clicked submit button for username.");
    } else {
      await this.page.keyboard.press("Enter");
      console.log("Pressed Enter to submit username.");
    }
    
  2. 0xF9M commented on Dec 24, 2025

    @0xF9M

    This might interest you: #3

  3. Lekebabiste commented on Dec 24, 2025

    @Lekebabiste
    Author

    const submitBtn = await this.page.$('button[type="submit"]');
    if (submitBtn) {
    await submitBtn.click();
    console.log("Clicked submit button for username.");
    } else {
    await this.page.keyboard.press("Enter");
    console.log("Pressed Enter to submit username.");
    }

    Where I put this lines ?
    I put it in snapbot.js but now I have to put me email manually

  4. 0xF9M commented on Dec 25, 2025

    @0xF9M

    Va voir mon fork ça devrait marcher : https://github.com/0xF9M/SnapBot

  5. Lekebabiste commented on Dec 25, 2025

    @Lekebabiste
    Author

    Va voir mon fork ça devrait marcher : https://github.com/0xF9M/SnapBot

    Depuis quand tu parles français ?

    Thanks alot! I added your code into the snapbot.js and it is working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions