@@ -49,9 +49,11 @@ which are basically nodes that you can traverse easily::
49
49
var_dump($domElement->nodeName);
50
50
}
51
51
52
- Specialized :class: `Symfony\\ Component\\ DomCrawler\\ Link ` and
52
+ Specialized :class: `Symfony\\ Component\\ DomCrawler\\ Link `,
53
+ :class: `Symfony\\ Component\\ DomCrawler\\ Image ` and
53
54
:class: `Symfony\\ Component\\ DomCrawler\\ Form ` classes are useful for
54
- interacting with html links and forms as you traverse through the HTML tree.
55
+ interacting with html links, images and forms as you traverse through the HTML
56
+ tree.
55
57
56
58
.. note ::
57
59
@@ -293,7 +295,7 @@ Links
293
295
~~~~~
294
296
295
297
To find a link by name (or a clickable image by its ``alt `` attribute), use
296
- the ``selectLink `` method on an existing crawler. This returns a Crawler
298
+ the ``selectLink `` method on an existing crawler. This returns a `` Crawler ``
297
299
instance with just the selected link(s). Calling ``link() `` gives you a special
298
300
:class: `Symfony\\ Component\\ DomCrawler\\ Link ` object::
299
301
@@ -317,6 +319,23 @@ methods to get more information about the selected link itself::
317
319
page suffixed with ``#foo ``. The return from ``getUri() `` is always a full
318
320
URI that you can act on.
319
321
322
+ Images
323
+ ~~~~~~
324
+
325
+ To find an image by its ``alt `` attribute, use the ``selectImage `` method on an
326
+ existing crawler. This returns a ``Crawler `` instance with just the selected
327
+ image(s). Calling ``image() `` gives you a special
328
+ :class: `Symfony\\ Component\\ DomCrawler\\ Image ` object::
329
+
330
+ $imagesCrawler = $crawler->selectImage('Kitten');
331
+ $image = $imagesCrawler->image();
332
+
333
+ // or do this all at once
334
+ $image = $crawler->selectImage('Kitten')->image();
335
+
336
+ The :class: `Symfony\\ Component\\ DomCrawler\\ Image ` object has the same
337
+ ``getUri() `` method as :class: `Symfony\\ Component\\ DomCrawler\\ Link `.
338
+
320
339
Forms
321
340
~~~~~
322
341
0 commit comments