@@ -21,27 +21,29 @@ selects the last one on the page, and then selects its immediate ancestor elemen
2121Many other methods are also available:
2222
2323``filter('h1.title') ``
24- Nodes that match the CSS selector.
24+ Finds nodes that match the given CSS selector (which must be supported by
25+ Symfony's :doc: `CSS Selector component </components/css_selector >`).
2526``filterXpath('h1') ``
26- Nodes that match the XPath expression.
27+ Finds nodes matching the given ` XPath expression `_ .
2728``eq(1) ``
28- Node for the specified index.
29+ Returns the node at the given index (`` 0 `` is the first node) .
2930``first() ``
30- First node.
31+ Returns the first node (equivalent to `` eq(0) ``) .
3132``last() ``
32- Last node.
33+ Returns the last node.
3334``siblings() ``
34- Siblings .
35+ Returns all sibling nodes (nodes with the same parent, excluding the current node) .
3536``nextAll() ``
36- All following siblings.
37+ Returns all following siblings (same parent, after the current node) .
3738``previousAll() ``
38- All preceding siblings.
39+ Returns all preceding siblings (same parent, before the current node) .
3940``ancestors() ``
40- Returns the ancestor nodes.
41+ Returns all ancestor nodes (parents, grandparents, etc., up to the ``<html> ``
42+ element).
4143``children() ``
42- Returns children nodes.
44+ Returns all direct child nodes of the current node .
4345``reduce($lambda) ``
44- Nodes for which the callable does not return false .
46+ Filters the nodes using a callback; keeps only those for which it returns `` true `` .
4547
4648Since each of these methods returns a new ``Crawler `` instance, you can
4749narrow down your node selection by chaining the method calls::
@@ -91,3 +93,5 @@ The Crawler can extract information from the nodes::
9193 $data = $crawler->each(function ($node, int $i): string {
9294 return $node->attr('href');
9395 });
96+
97+ .. _`XPath expression` : https://developer.mozilla.org/en-US/docs/Web/XML/XPath
0 commit comments