This works
$this->assertEquals(1, $crawler->filter('.elementClass')->count()); // filter by class
But, this doesn't seem to work.
$this->assertEquals(1, $crawler->filter('#elementId')->count()); // filter by id
Any ideas?
Symfony2 DOM Crawler filter internally uses DOMXPath, so you can find answer for your question on this thread
query for filter should be something like(note that code bellow is untested, I'm sure link above will help you)
//*[@id='elementId']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With