Search code examples
codeceptjs

codeceptJS - how to click specific element from list


With protractor it's possible by doing element.all(by.css("li")).get(0)

How to do it with codecept?

I tried with no success:

I.click('.item').get(1);
I.click('.item:nth-child(2)');

Solution

  • You could just use XPath to click the first li element.

    I.click('//li[1]');