Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

66
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!

7 months ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos