I have a $foo which is an instance of Crawler and $foo->outerHtml() starts with <div class=”brick brick–type–test brick–id–1. I am writing a test and I’d like to assert brick–id–1 is indeed present as a class. How could I do this? (preg_match() on $foo->outerHtml() invokes Cthulhu, I’d rather not) Answer Evaluate an XPATH expression against the nodes to check whether they
Tag: domcrawler
How to test form submission with wrong values using Symfony crawler component and PHPUnit?
When you’re using the app through the browser, you send a bad value, the system checks for errors in the form, and if something goes wrong (it does in this case), it redirects with a default error message written below the incriminated field. This is the behaviour I am trying to assert with my test case, but I came accross
Guzzle Symfony scrape iframes inside multiple Servers
I am building a scraper to scrape content using guzzle and symfony dom crawler But I run into an issue. The page I am scraping has multiple Iframe servers They default iframe is shown when the scraper loads the page but in order to get the other servers it needs to click there buttons and so it reflects the server
extract untagged elements with symfony dom crawler
How to extract untagged elements with symfony dom crawler. For example in the sample html below I want to extract Hello World. titleHello WorldSub-Title