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

130
Views
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 answers
Answer question

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