當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。