Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda