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

174
Views
Transportador Angular2 E2E. Espere hasta que el elemento tenga clase

Necesito encontrar una manera de esperar con mi prueba e2e (proyecto angular2) hasta que el elemento probado obtenga una clase css específica .

¿Hay alguna forma posible sin browser.wait() o browser.sleep() ?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Incluso usó la palabra "esperar" en la pregunta, pero pidió resolverlo sin las funciones de espera integradas. No le veo mucho sentido a eso.

Hemos resuelto algo similar antes y creamos una función de espera personalizada que se puede usar como una Condición esperada con browser.wait() :

 function waitForCssClass(elementFinder, desiredClass) { return function () { return elementFinder.getAttribute('class').then(function (classValue) { return classValue && classValue.indexOf(desiredClass) >= 0; }); }; }; browser.wait(waitForCssClass($("#myid"), "desiredClass"), 5000);
over 4 years ago · Santiago Trujillo Report

0

Esta función espera a que una clase desaparezca de un elemento, dado el objeto del elemento (ElementFinder) y la clase CSS que desea verificar.

 static async waitCssClassToDisappear(elem:ElementFinder, cssClass:string, timeout?: number) { await browser.wait(()=>{ return elem.getAttribute('class').then((value) =>{ return value.indexOf(cssClass) < 0; }); }, timeout ? timeout : Utils.defaultTimeout, 'CSS class did not disappear within specified timeout'); }

over 4 years ago · Santiago Trujillo 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!