Several changes have been made to the public API in 2.0 in order to keep compatibility with Symfony 4.3:
-
HtmlPageCrawler::html()
is now just the parentCrawler::html()
and acts as getter only. Setting HTML content viaHtmlPageCrawler::html($html)
is not possible any more, useHtmlPageCrawler::setInnerHtml($html)
instead -
HtmlPageCrawler::text()
is now just the parentCrawler::text()
and acts as getter only that returns the text content from the first node only. For setting text content, useHtmlPageCrawler::setText($text)
instead. -
new method
HtmlPageCrawler::getCombinedText()
that returns the combined text from all nodes (as jQuery'stext()
function does and previous versions ofHtmlPageCrawler::text()
did) -
HtmlPageCrawler::attr()
is now just the parentCrawler::attr()
and acts as getter only. For setting attributes useHtmlPageCrawler::setAttribute($name, $value)
-
removed method
HtmlPageCrawler::isDisconnected()
To update your code, you have to:
- replace all calls to
$MyCrawlerInstance->html($html)
used as setter by$MyCrawlerInstance->setInnerHtml($html)
- replace all calls to
$MyCrawlerInstance->attr($name, $value)
used as setter by$MyCrawlerInstance->setAttribute($name, $value)
- replace all calls to
$MyCrawlerInstance->text($text)
used as setter by$MyCrawlerInstance->setText($text)
- replace all calls to
$MyCrawlerInstance->text()
(i.e. every call totext()
not preceded byfirst()
) by$MyCrawlerInstance->getCombinedText()
- replace all calls to
$MyCrawlerInstance->first()->text()
by$MyCrawlerInstance->text()