I am facing a challenge with locating certain webElements on the page based on specific text conditions. The elements return the following text when converted:
School, Primary School\n' +
Church, Catholic Church,
FireStation, Primary Station\n' +
Church, Catholic Church,
School, Primary School\n' +
FireStation, Primary Station,
My goal is to identify and locate the first element from the list which contains:
School, Primary School\n' +
Church, Catholic Church,
I have attempted to locate them using 2 separate conditions but chaining seems to be ineffective.
element(by.cssContainingText('.given_class',`${interpolation[for_school]}`, `${interpolation[for_church]}`)).getText()
Unfortunately, this approach did not provide the desired outcome. I also tried chaining locators without success:
element(by.cssContainingText('.given_class',`${interpolation[for_school]}`)).element(by......`)).getText()
Despite trying various methods, I have been unable to successfully locate these elements on the page. Each element shares similar attributes such as class, id, and type, making it essential to find them specifically by text content.