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


PHP Session::getSelectorsHandler方法代码示例

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


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

示例1: __construct

 /**
  * Initialize element.
  *
  * @param Session $session
  */
 public function __construct(Session $session)
 {
     $this->xpathManipulator = new Manipulator();
     $this->session = $session;
     $this->driver = $session->getDriver();
     $this->selectorsHandler = $session->getSelectorsHandler();
 }
开发者ID:molchanoviv,项目名称:Mink,代码行数:12,代码来源:Element.php

示例2: createElement

 /**
  * @param string $name
  *
  * @return NodeElement
  */
 protected function createElement($name)
 {
     if (isset($this->elements[$name])) {
         return new NodeElement($this->getSelectorAsXpath($this->elements[$name], $this->session->getSelectorsHandler()), $this->session);
     }
     throw new \InvalidArgumentException();
 }
开发者ID:vikey89,项目名称:Sylius,代码行数:12,代码来源:Page.php

示例3: attachSeleniumSelector

 /**
  * Attaches Selenium selector, that is later used during annotation processing.
  *
  * @param Session $session Mink session.
  *
  * @return self
  */
 protected function attachSeleniumSelector(Session $session)
 {
     $selectors_handler = $session->getSelectorsHandler();
     if (!$selectors_handler->isSelectorRegistered('se')) {
         $selectors_handler->registerSelector('se', new SeleniumSelector($selectors_handler));
     }
     return $session;
 }
开发者ID:virtua-network,项目名称:qa-tools,代码行数:15,代码来源:PageFactory.php

示例4: createElement

 /**
  * @param string $name
  * @param array $parameters
  *
  * @return NodeElement
  */
 private function createElement($name, array $parameters = [])
 {
     $definedElements = $this->getDefinedElements();
     if (!isset($definedElements[$name])) {
         throw new \InvalidArgumentException(sprintf('Could not find a defined element with name "%s". The defined ones are: %s.', $name, implode(', ', array_keys($definedElements))));
     }
     $elementSelector = strtr($definedElements[$name], $parameters);
     return new NodeElement($this->getSelectorAsXpath($elementSelector, $this->session->getSelectorsHandler()), $this->session);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:15,代码来源:Page.php

示例5: findField

 /**
  * @param $selector
  * @return \Behat\Mink\Element\NodeElement
  */
 protected function findField($selector)
 {
     $selector = $this->escape($selector);
     $page = $this->session->getPage();
     $field = $page->find('named', array('field', $this->session->getSelectorsHandler()->xpathLiteral($selector)));
     if (!$field) {
         $field = $page->find('css', $selector);
     }
     if (!$field) {
         \PHPUnit_Framework_Assert::fail("Field matching id|name|label|value or css selector does not exists");
     }
     return $field;
 }
开发者ID:nike-17,项目名称:Codeception,代码行数:17,代码来源:Mink.php

示例6: findField

 /**
  * @param $selector
  * @return \Behat\Mink\Element\NodeElement|null
  * @throws \Codeception\Exception\ElementNotFound
  */
 protected function findField($selector)
 {
     $page = $this->session->getPage();
     $field = $page->find('named', array('field', $this->session->getSelectorsHandler()->xpathLiteral($selector)));
     if (!$field and Locator::isCSS($selector)) {
         $field = $page->find('css', $selector);
     }
     if (!$field and Locator::isXPath($selector)) {
         $field = @$page->find('xpath', $selector);
     }
     if (!$field) {
         throw new ElementNotFound($selector, "Field by name, label, CSS or XPath");
     }
     return $field;
 }
开发者ID:NaszvadiG,项目名称:ImageCMS,代码行数:20,代码来源:Mink.php

示例7: findField

 /**
  * @param $selector
  * @return \Behat\Mink\Element\NodeElement
  */
 protected function findField($selector)
 {
     $page = $this->session->getPage();
     $field = $page->find('named', array('field', $this->session->getSelectorsHandler()->xpathLiteral($selector)));
     try {
         if (!$field) {
             $field = $page->find('css', $selector);
         }
     } catch (\Symfony\Component\CssSelector\Exception\ParseException $e) {
     }
     if (!$field) {
         $field = @$page->find('xpath', $selector);
     }
     if (!$field) {
         \PHPUnit_Framework_Assert::fail("Field matching id|name|label|value or css or xpath selector does not exist");
     }
     return $field;
 }
开发者ID:pfz,项目名称:codeception,代码行数:22,代码来源:Mink.php

示例8: testInstantiateWithoutOptionalDeps

 public function testInstantiateWithoutOptionalDeps()
 {
     $session = new Session($this->driver);
     $this->assertInstanceOf('Behat\\Mink\\Selector\\SelectorsHandler', $session->getSelectorsHandler());
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:5,代码来源:SessionTest.php

示例9: seleniumSelectorToXpath

 /**
  * Returns 'xpath' selector, used to locate this WebElement.
  *
  * @param Session $session Session.
  *
  * @return string
  */
 protected function seleniumSelectorToXpath(Session $session)
 {
     return $session->getSelectorsHandler()->selectorToXpath('se', $this->seleniumSelector);
 }
开发者ID:eltonoliveira,项目名称:qa-tools,代码行数:11,代码来源:WebElement.php

示例10: testGetSelectorsHandler

 public function testGetSelectorsHandler()
 {
     $this->assertSame($this->selectorsHandler, $this->session->getSelectorsHandler());
 }
开发者ID:molchanoviv,项目名称:Mink,代码行数:4,代码来源:SessionTest.php

示例11: sprintf

<?php

require_once __DIR__ . '/vendor/autoload.php';
use Behat\Mink\Driver\GoutteDriver;
use Behat\Mink\Session;
use Behat\Mink\Driver\Selenium2Driver;
//$driver = new GoutteDriver();
$driver = new Selenium2Driver();
$session = new Session($driver);
$session->start();
$session->visit('http://jurassicpark.wikia.com');
//echo "Status code: ". $session->getStatusCode() . "\n";
echo "Current URL: " . $session->getCurrentUrl() . "\n";
$page = $session->getPage();
echo "First 160 chars: " . substr($page->getText(), 0, 160) . "\n";
//$anchorEle = $page->find('css', 'h3 a.title');
//$spanEle = $anchorElement->find('css', 'span.emph');
$element = $page->find('css', '.subnav-2 li a');
echo "The link text is: " . $element->getText() . "\n";
$selectorsHandler = $session->getSelectorsHandler();
$element = $page->find('named', array('link', $selectorsHandler->xpathLiteral('Random page')));
$element = $page->findLink('Random page');
echo sprintf("The URL is '%s'\n", $element->getAttribute('href'));
$element->click();
$element->click();
echo "Page URL after click: " . $session->getCurrentUrl() . "\n";
//behat-ls/vendor/behat/mink/src/Behat/Mink/Selector/NamedSelector.php@$selectors
$session->stop();
开发者ID:elagith,项目名称:learningMaterial,代码行数:28,代码来源:mink-playground.php

示例12: _setSession

 /**
  * Sets session.
  *
  * @param Session $session Session.
  *
  * @return self
  */
 private function _setSession(Session $session)
 {
     $selectors_handler = $session->getSelectorsHandler();
     if (!$selectors_handler->isSelectorRegistered('se')) {
         $selectors_handler->registerSelector('se', new SeleniumSelector());
     }
     $this->_session = $session;
     return $this;
 }
开发者ID:qa-tools,项目名称:qa-tools,代码行数:16,代码来源:PageFactory.php


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