Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

251
Views
¿Cómo obtener el atributo de un elemento en una prueba de Dramaturgo?

Estoy tratando de obtener el atributo de un elemento en una prueba. Mi prueba se ve así:

 test(`Should be at least 5 characters long`, async({ page }) => { await page.goto('http://localhost:8080'); const field = await page.locator('id=emailAddress'); const _attribute = await field.getAttribute('minlength'); const minlength = Number(_attribute); await expect(minlength).toBeGreaterThanOrEqual(5); });

Cuando ejecuto esto, puedo ver que el valor de minlength es 0 . Esto se debe a que _attribute es null . Sin embargo, no entiendo por qué. El field es un Locator . Pero, parece que no puedo obtener el atributo o su valor. ¿Qué estoy haciendo mal?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo siguiente funcionó para mí

 const inputElement = page.locator('#emailAddress'); minLength = await inputElement.evaluate(e => (e as HTMLInputElement).minLength);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!