These are chat archives for Behat/Behat

14th
Nov 2016
Ronaldo Drummond
@ronaldodrummond_twitter
Nov 14 2016 12:52
Hi folks. I have two fields (with the same class name) and I want to get the second: I tried it and other variations: find('css','div.btn.btn-travel-date:nth-child(1)')
but it doesn't work. Someone can help to use this nth-child?
Ciaran McNulty
@ciaranmcnulty
Nov 14 2016 13:08
you can do findAll and take the second element?
Ronaldo Drummond
@ronaldodrummond_twitter
Nov 14 2016 13:35
I tried with findAll too, but doesn't works for the second button :(
Ciaran McNulty
@ciaranmcnulty
Nov 14 2016 13:36
I mean findall without nth-child, right?
Ronaldo Drummond
@ronaldodrummond_twitter
Nov 14 2016 13:54
hmm let me try
Ronaldo Drummond
@ronaldodrummond_twitter
Nov 14 2016 14:03

It's works! :)

var_dump($page->findAll('css','.btn.btn-travel-date')[1]->getText());

Thank you Ciaran!

Ciaran McNulty
@ciaranmcnulty
Nov 14 2016 14:35
no problem