Symfony\Component\BrowserKit\Client::click PHP Method

click() public method

Clicks on a given link.
public click ( Symfony\Component\DomCrawler\Link $link )
$link Symfony\Component\DomCrawler\Link A Link instance
    public function click(Link $link)
    {
        if ($link instanceof Form) {
            return $this->submit($link);
        }

        return $this->request($link->getMethod(), $link->getUri());
    }

Same methods

Client::click ( Symfony\Component\DomCrawler\Link $link ) : Crawler

Usage Example

Ejemplo n.º 1
0
    protected function clickByLocator($link)
    {
        $nodes = $this->match($link);

        if (!$nodes->count()) {
            throw new ElementNotFound($link, 'Link or Button by name or CSS or XPath');
        }

        foreach ($nodes as $node) {
            $tag = $node->nodeName;
            $type = $node->getAttribute('type');
            if ($tag == 'a') {
                $this->crawler = $this->client->click($nodes->first()->link());
                $this->forms = [];
                $this->debugResponse();
                return;
            } elseif(
                ($tag == 'input' && in_array($type, array('submit', 'image'))) ||
                ($tag == 'button' && $type == 'submit'))
            {
                $this->submitFormWithButton($nodes->first());
                $this->debugResponse();
                return;
            }
        }

    }
All Usage Examples Of Symfony\Component\BrowserKit\Client::click