• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

165
Vistas
Im trying to automate a login on a page using puppeteer, once I login on the next page I want to click a button which is present on the next page

To perform automation on the next page do I have to write some different code in a different function as the URL changes after logging in also the button which I'm trying to click on the next page doesn't have any ID or CLASS. Here is the button which im trying to select:

<div class="BenchTool NewEnquiry Orange" data-bind="click: Logic.Enquiry.NewEnquiry">
                    <div>&nbsp;</div>
                    <span>New Enquiry</span>
                </div>

Here is the code which I have written in puppeteer

const puppeteer = require("puppeteer");

async function main () {
    const browser = await puppeteer.launch({
        headless: false
    });
const page = await browser.newPage();
await page.goto("https://onecall.linesearchbeforeudig.co.uk/uk-b4-en/Account/Login?returnUrl=%2Fuk-b4-en%2FWorkBench");
await page.$eval('input[name=emailOrUserName]', el => el.value = 'Pramod Rai');
await page.$eval('input[name=password]', el => el.value = '******');
await page.click('#acceptTermsAndConditions');
await page.click('#login-submit');
}; 
main();

Im able to login using this code but not able to click the button on the next page, I tried pressing Enter that doesn't work, also tried clicking it based on Co-ordinates but that doesn't seem to work as well; any help will be appreciated. Thanks!

almost 3 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda