Perform a click on a link or a button, given by a locator.
If a fuzzy locator is given, the page will be searched for a button, link, or image matching the locator string.
For buttons, the "value" attribute, "name" attribute, and inner text are searched.
For links, the link text is searched.
For images, the "alt" attribute and inner text of any parent links are searched.
The second parameter is a context (CSS or XPath locator) to narrow the search.
Note that if the locator matches a button of type submit, the form will be submitted.
php
click('Logout');
button of form
$I->click('Submit');
CSS button
$I->click('#form input[type=submit]');
XPath
$I->click('//form/*[@type=submit]');
link in context
$I->click('Logout', '#nav');
using strict locator
$I->click(['link' => 'Login']);
?>
public click ( $link, $context = null ) | ||
$link | ||
$context |