I'm using the DomCrawler component: http://symfony.com/doc/current/components/dom_crawler.html
I'd like to, using the CSS like syntax, get an element with a specific attribute value.
Here's the code I'm using:
$link = $crawler->filter('#product a[data-type="bla"]');
This seems to work, as the following returns 1:
echo count($link);
However, I can never not filter further than this. I can not do:
$link->filter('img')->attr('src');
This results in the following error message:
The current node list is empty.
However, I know for certain that it isn't.
I've tried the syntax on other elements and it's always the same. I am doing something wrong or is this not possible (with css like syntax, not xpath)