本文整理匯總了PHP中Behat\Mink\Element\NodeElement::click方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeElement::click方法的具體用法?PHP NodeElement::click怎麽用?PHP NodeElement::click使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Behat\Mink\Element\NodeElement
的用法示例。
在下文中一共展示了NodeElement::click方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: replyComment
/**
* @param NodeElement $comment
* @param string $message
*
* @throws \LogicException
*/
public function replyComment(NodeElement $comment, $message)
{
$comment->click();
$replyBox = $this->getElement('Comment threads')->find('css', 'li.reply-to-comment');
if (!$replyBox) {
throw new \LogicException('Comment reply box not found !');
}
$textarea = $replyBox->find('css', 'textarea');
if (!$textarea) {
throw new \LogicException('Comment reply textarea not found !');
}
$textarea->setValue($message);
$this->spin(function () use($replyBox) {
$replyBox->find('css', '.send-comment')->click();
return true;
});
}
示例2: replyComment
/**
* @param NodeElement $comment
* @param string $message
*
* @throws \LogicException
*/
public function replyComment(NodeElement $comment, $message)
{
$comment->click();
$replyBox = $this->getElement('Comment threads')->find('css', 'li.comment-reply-action.toggle-active');
if (!$replyBox) {
throw new \LogicException('Comment reply box not found !');
}
$textarea = $replyBox->find('css', 'textarea');
if (!$textarea) {
throw new \LogicException('Comment reply textarea not found !');
}
$textarea->setValue($message);
$replyBox->pressButton('Reply');
}
示例3: testClick
public function testClick()
{
$node = new NodeElement('link_or_button', $this->session);
$this->driver->expects($this->once())->method('click')->with('link_or_button');
$node->click();
}
示例4: interactWithElement
/**
* Applies a specific action to an element
*
* @param NodeElement $element Element to act on
* @param string $action Action, which may be one of 'hover', 'double click', 'right click', or 'left click'
* The default 'click' behaves the same as left click
*/
protected function interactWithElement($element, $action = 'click')
{
switch ($action) {
case 'hover':
$element->mouseOver();
break;
case 'double click':
$element->doubleClick();
break;
case 'right click':
$element->rightClick();
break;
case 'left click':
case 'click':
default:
$element->click();
break;
}
}
示例5: toggleResource
/**
* @param NodeElement $resource
*/
public function toggleResource(NodeElement $resource)
{
$groupTitleElement = $this->spin(function () use($resource) {
return $resource->getParent()->getParent()->getParent()->find('css', 'h3');
}, 'Group title not found for resource.');
$groupTitle = $groupTitleElement->getHtml();
$this->navigateToGroup($groupTitle);
$this->spin(function () use($resource) {
return $resource->isVisible();
}, sprintf('Resource is not visible on the group %s.', $groupTitle));
$resource->click();
}