Skip to content

[BrowserKit] Add argument $serverParameters to click() and clickLink() #18659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions components/browser_kit.rst
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,28 @@ provides access to the link properties (e.g. ``$link->getMethod()``,
$link = $crawler->selectLink('Go elsewhere...')->link();
$client->click($link);

The :method:`Symfony\\Component\\BrowserKit\\AbstractBrowser::click` and
:method:`Symfony\\Component\\BrowserKit\\AbstractBrowser::clickLink` methods
can take an optional ``serverParameters`` argument. This
parameter allows to send additional information like headers when clicking
on a link::

use Acme\Client;

$client = new Client();
$client->request('GET', '/product/123');

// works both with `click()`...
$link = $crawler->selectLink('Go elsewhere...')->link();
$client->click($link, ['X-Custom-Header' => 'Some data']);

// ... and `clickLink()`
$crawler = $client->clickLink('Go elsewhere...', ['X-Custom-Header' => 'Some data']);

.. versionadded:: 6.4

The ``serverParameters`` parameter was introduced in Symfony 6.4.

Submitting Forms
~~~~~~~~~~~~~~~~

Expand Down