10000 added a link snippit · symfony/symfony-docs@dda78ba · GitHub
[go: up one dir, main page]

Skip to content

Commit dda78ba

Browse files
yamikojaviereguiluz
yamiko
authored andcommitted
added a link snippit
1 parent 94bb3bf commit dda78ba

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

components/browser_kit/introduction.rst

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,29 @@ Making Request
2828

2929
To make a request you use the client's request method.
3030
The first two arguments are for the HTTP method and the request url.
31+
The request method will return a crawler object.
3132

3233
.. code-block:: php
3334
3435
use ACME\Client;
3536
3637
$client = new Client();
37-
$response = $client->request('GET', 'http://symfony.com');
38+
$crawler = $client->request('GET', 'http://symfony.com');
3839
3940
Clicking Links
4041
~~~~~~~~~~~~~~
4142

43+
select a link with the crawler and pass it to the click method to click on the link.
44+
45+
.. code-block:: php
46+
47+
use ACME\Client;
48+
49+
$client = new Client();
50+
$crawler = $client->request('GET', 'http://symfony.com');
51+
$link = $crawler->selectLink('Go elsewhere...')->link();
52+
$client->click($link);
53+
4254
Submiting Forms
4355
~~~~~~~~~~~~~~~~
4456

0 commit comments

Comments
 (0)
0