当前位置: 首页>>代码示例>>PHP>>正文


PHP Client::click方法代码示例

本文整理汇总了PHP中Symfony\Component\BrowserKit\Client::click方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::click方法的具体用法?PHP Client::click怎么用?PHP Client::click使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\BrowserKit\Client的用法示例。


在下文中一共展示了Client::click方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: clickByLocator

    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;
            }
        }

    }
开发者ID:Vrian7ipx,项目名称:cascadadev,代码行数:27,代码来源:InnerBrowser.php

示例2: click

 public function click($link)
 {
     $link = $this->escape($link);
     $anchor = $this->crawler->selectLink($link);
     if (count($anchor)) {
         $this->crawler = $this->client->click($anchor->first()->link());
         $this->debugResponse();
         return;
     }
     $button = $this->crawler->selectButton($link);
     if (count($button)) {
         $this->submitFormWithButton($button);
         $this->debugResponse();
         return;
     }
     \PHPUnit_Framework_Assert::fail("Link or button for '{$link}' was not found");
 }
开发者ID:BatVane,项目名称:Codeception,代码行数:17,代码来源:Framework.php

示例3: click

 public function click($link, $context = null)
 {
     $literal = Crawler::xpathLiteral($link);
     if ($context) {
         $this->crawler = $this->match($context);
     }
     $anchor = $this->crawler->filterXPath('.//a[.=' . $literal . ']');
     if (!count($anchor)) {
         $anchor = $this->crawler->selectLink($link);
     }
     if (count($anchor)) {
         $this->crawler = $this->client->click($anchor->first()->link());
         $this->debugResponse();
         return;
     }
     $button = $this->crawler->selectButton($link);
     if (count($button)) {
         $this->submitFormWithButton($button);
         $this->debugResponse();
         return;
     }
     $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->debugResponse();
             return;
         } elseif ($tag == 'input' && in_array($type, array('submit', 'image')) || $tag == 'button' && $type == 'submit') {
             $this->submitFormWithButton($nodes->first());
             $this->debugResponse();
             return;
         }
     }
 }
开发者ID:lenninsanchez,项目名称:donadores,代码行数:39,代码来源:Framework.php

示例4: click

 public function click($link, $context = null)
 {
     $literal = Crawler::xpathLiteral($link);
     if ($context) {
         $this->crawler = $this->match($context);
     }
     $anchor = $this->crawler->filterXPath('.//a[.=' . $literal . ']');
     if (!count($anchor)) {
         $anchor = $this->crawler->selectLink($link);
     }
     if (count($anchor)) {
         $this->crawler = $this->client->click($anchor->first()->link());
         $this->debugResponse();
         return;
     }
     $button = $this->crawler->selectButton($link);
     if (count($button)) {
         $this->submitFormWithButton($button);
         $this->debugResponse();
         return;
     }
     $nodes = $this->match($link);
     if ($nodes->count()) {
         foreach ($nodes as $node) {
             if ($node->nodeName == 'a') {
                 $this->crawler = $this->client->click($nodes->first()->link());
                 $this->debugResponse();
                 return;
             } elseif ($node->nodeName == 'input' && $node->getAttribute('type') == 'submit') {
                 $this->submitFormWithButton($nodes->first());
                 $this->debugResponse();
                 return;
             }
         }
     }
     \PHPUnit_Framework_Assert::fail("Link or button for '{$link}' was not found");
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:37,代码来源:Framework.php

示例5: clickByLocator

 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();
             break;
         } elseif (in_array($tag, ['input', 'button']) && in_array($type, ['submit', 'image'])) {
             $this->proceedSubmitForm($nodes->parents()->filter('form')->first(), [$nodes->first()->attr('name') => $nodes->first()->attr('value')]);
             break;
         }
     }
 }
开发者ID:alexanderkuz,项目名称:test-yii2,代码行数:20,代码来源:InnerBrowser.php


注:本文中的Symfony\Component\BrowserKit\Client::click方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。