@@ -48,9 +48,11 @@ traverse easily::
48
48
print $domElement->nodeName;
49
49
}
50
50
51
- Specialized :class: `Symfony\\ Component\\ DomCrawler\\ Link ` and
51
+ Specialized :class: `Symfony\\ Component\\ DomCrawler\\ Link `,
52
+ :class: `Symfony\\ Component\\ DomCrawler\\ Image ` and
52
53
:class: `Symfony\\ Component\\ DomCrawler\\ Form ` classes are useful for
53
- interacting with html links and forms as you traverse through the HTML tree.
54
+ interacting with html links, images and forms as you traverse through the HTML
55
+ tree.
54
56
55
57
.. note ::
56
58
@@ -303,7 +305,7 @@ Links
303
305
~~~~~
304
306
305
307
To find a link by name (or a clickable image by its ``alt `` attribute), use
306
- the ``selectLink `` method on an existing crawler. This returns a Crawler
308
+ the ``selectLink `` method on an existing crawler. This returns a `` Crawler ``
307
309
instance with just the selected link(s). Calling ``link() `` gives you a special
308
310
:class: `Symfony\\ Component\\ DomCrawler\\ Link ` object::
309
311
@@ -327,6 +329,23 @@ methods to get more information about the selected link itself::
327
329
page suffixed with ``#foo ``. The return from ``getUri() `` is always a full
328
330
URI that you can act on.
329
331
332
+ Images
333
+ ~~~~~~
334
+
335
+ To find an image by its ``alt `` attribute, use the ``selectImage `` method on an
336
+ existing crawler. This returns a ``Crawler `` instance with just the selected
337
+ image(s). Calling ``image() `` gives you a special
338
+ :class: `Symfony\\ Component\\ DomCrawler\\ Image ` object::
339
+
340
+ $imagesCrawler = $crawler->selectImage('Kitten');
341
+ $image = $imagesCrawler->image();
342
+
343
+ // or do this all at once
344
+ $image = $crawler->selectImage('Kitten')->image();
345
+
346
+ The :class: `Symfony\\ Component\\ DomCrawler\\ Image ` object has the same
347
+ ``getUri() `` method as :class: `Symfony\\ Component\\ DomCrawler\\ Link `.
348
+
330
349
Forms
331
350
~~~~~
332
351
0 commit comments