1

basically I have the following:

<div class="container">
  <div class="title">title 1</div>
</div>
<div class="container">
  <div class="title">title 2</div>
</div>
<div class="container">
  <div class="title">title 3</div>
</div>

I want to locate the container that has "title 2" as title, without Xpath Please. I mean just css selectors and codeceptJS functions. Is it possible to do it?

JacobBrown2019
  • 85
  • 2
  • 4
  • 10

1 Answers1

2

You can do:

locate(".container").withChild(".title").withText("title 2")

See the locator builder documentation for more info.

Roman Mkrtchian
  • 2,548
  • 1
  • 17
  • 24