Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
locate element in protractor from multiline text

I have few webElements, which when converted to text return:

School, Primary School\n' +
Church, Catholic Church,

FireStation, Primary Station\n' +
Church, Catholic Church,

School, Primary School\n' +
FireStation, Primary Station,

They need to be located by 2 separate conditions, but I am unable to chain them. I am trying to locate the first element from list

School, Primary School\n' +
Church, Catholic Church,

by using:

element(by.cssContainingText('.given_class',`${interpolation[for_school]}`, `${interpolation[for_church]}`)).getText()

Nothing works. I have tried chaining locators

element(by.cssContainingText('.given_class',`${interpolation[for_school]}`)).element(by......`)).getText()

no luck

I have tried using few other methods, but nothing seems to work.

They all have the same class, id, type etc. They need to be found by text

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

use xpath and operator

element(by.xpath('//*[contains(text(),"locate element") and contains(text(),"from multiline text")]'))

you can try it on this page to locate questions header //*[contains(text(),"locate element") and contains(text(),"from multiline text")]

about 4 years ago · Juan Pablo Isaza Denunciar
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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda