Skip to content

Commit 6b6e23a

Browse files
yamiko-ninjajaviereguiluz
authored andcommitted
added docs on histroy
1 parent a3d158e commit 6b6e23a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

components/browser_kit/introduction.rst

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ Select a link with the crawler and pass it to the click method to click on the l
8080
Submiting Forms
8181
~~~~~~~~~~~~~~~
8282

83+
You can submit forms with the submit method which takes a form object.
84+
You can get the form object by using the crawler to select the button and running the form method.
85+
8386
.. code-block:: php
8487
8588
use ACME\Client;
@@ -102,6 +105,39 @@ Cookies
102105
History
103106
-------
104107

108+
The client stores all your request allowing you to go back and forward in your history.
109+
110+
.. code-block:: php
111+
112+
use ACME\Client;
113+
114+
// make a real request to an external site
115+
$client = new Client();
116+
$home_crawler = $client->request('GET', 'http://symfony.com');
117+
118+
// select and click on a link
119+
$doc_link = $crawler->selectLink('Documentation')->link();
120+
$doc_crawler = $client->click($link);
121+
122+
// go back to home page
123+
$home_crawler = $client->back();
124+
125+
// go forward to documentation page
126+
$doc_crawler = $client->forward();
127+
128+
You can restart the clients history with the restart method. This will also clear out the CookieJar.
129+
130+
.. code-block:: php
131+
132+
use ACME\Client;
133+
134+
// make a real request to an external site
135+
$client = new Client();
136+
$home_crawler = $client->request('GET', 'http://symfony.com');
137+
138+
// restart history
139+
$client->restart();
140+
105141
Insulated Request
106142
-----------------
107143

0 commit comments

Comments
 (0)