當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NodeElement::getXpath方法代碼示例

本文整理匯總了PHP中Behat\Mink\Element\NodeElement::getXpath方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeElement::getXpath方法的具體用法?PHP NodeElement::getXpath怎麽用?PHP NodeElement::getXpath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Behat\Mink\Element\NodeElement的用法示例。


在下文中一共展示了NodeElement::getXpath方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(NodeElement $node, Session $session)
 {
     if (!$node->hasClass(self::NOTICE_CLASS)) {
         throw new \InvalidArgumentException(sprintf('Provided node does not have class %s', self::NOTICE_CLASS));
     }
     parent::__construct($node->getXpath(), $session);
 }
開發者ID:stephenharris,項目名稱:WordPressBehatExtension,代碼行數:7,代碼來源:Notice.php

示例2: fromNodeElement

 /**
  * Creates Element instance based on existing NodeElement instance.
  *
  * @param NodeElement  $node_element Node element.
  * @param IPageFactory $page_factory Page factory.
  *
  * @return static
  * @throws ElementException When page factory is missing.
  */
 public static function fromNodeElement(NodeElement $node_element, IPageFactory $page_factory = null)
 {
     if (!isset($page_factory)) {
         throw new ElementException('Page factory is required to create this element', ElementException::TYPE_PAGE_FACTORY_REQUIRED);
     }
     $selenium_selector = array(How::XPATH => $node_element->getXpath());
     return new static($selenium_selector, $page_factory);
 }
開發者ID:eltonoliveira,項目名稱:qa-tools,代碼行數:17,代碼來源:AbstractElementContainer.php

示例3: setNode

 /**
  * @param NodeElement $node
  */
 public function setNode(NodeElement $node)
 {
     $this->node = $node;
     $this->setXpath($node->getXpath());
     $this->visible = $node->isVisible();
     $id = $node->getAttribute('id');
     if ($id) {
         $this->setId($id);
     }
     $classes = $node->getAttribute('class');
     if ($classes) {
         $this->classes = explode(' ', $classes);
     }
     $this->attributes = self::parseAttribs($node);
 }
開發者ID:dafik,項目名稱:cc-tests-reverse,代碼行數:18,代碼來源:Element.php

示例4: testGetXpath

 public function testGetXpath()
 {
     $node = new NodeElement('some custom xpath', $this->session);
     $this->assertEquals('some custom xpath', $node->getXpath());
     $this->assertNotEquals('not some custom xpath', $node->getXpath());
 }
開發者ID:jordi12100,項目名稱:Mink,代碼行數:6,代碼來源:NodeElementTest.php

示例5: fromNodeElement

 /**
  * Creates Element instance based on existing NodeElement instance.
  *
  * @param NodeElement  $node_element Node element.
  * @param IPageFactory $page_factory Page factory.
  *
  * @return static
  */
 public static function fromNodeElement(NodeElement $node_element, IPageFactory $page_factory = null)
 {
     $selenium_selector = array(How::XPATH => $node_element->getXpath());
     return new static($selenium_selector, $node_element->getSession());
 }
開發者ID:eltonoliveira,項目名稱:qa-tools,代碼行數:13,代碼來源:WebElement.php

示例6: dragElementTo

 /**
  * Drags an element on another one.
  * Works better than the standard dragTo.
  *
  * @param NodeElement $element
  * @param NodeElement $dropZone
  */
 public function dragElementTo(NodeElement $element, NodeElement $dropZone)
 {
     $session = $this->getSession()->getDriver()->getWebDriverSession();
     $from = $session->element('xpath', $element->getXpath());
     $to = $session->element('xpath', $dropZone->getXpath());
     $session->moveto(['element' => $from->getID()]);
     $session->buttondown('');
     $session->moveto(['element' => $to->getID()]);
     $session->buttonup('');
 }
開發者ID:aml-bendall,項目名稱:ExpandAkeneoApi,代碼行數:17,代碼來源:Base.php

示例7: __construct

 /**
  * A bit of a hack, we require the Session to create instances of WPTableRow, so we store it here
  * @param NodeElement $node
  * @param Session $session
  */
 public function __construct(NodeElement $node, Session $session)
 {
     parent::__construct($node->getXpath(), $session);
     $this->session = $session;
 }
開發者ID:stephenharris,項目名稱:WordPressBehatExtension,代碼行數:10,代碼來源:WPTableRow.php

示例8: executeJsOnElement

 /**
  * @param NodeElement $element
  * @param string $script
  *
  * @example
  * $this->executeJsOnElement($this->element('*', 'Meta tags'), 'return jQuery({{ELEMENT}}).text();');
  * $this->executeJsOnElement($this->element('*', '#menu'), '{{ELEMENT}}.focus();');
  *
  * @throws \Exception
  *
  * @return mixed
  */
 public function executeJsOnElement(NodeElement $element, $script)
 {
     $session = $this->getWebDriverSession();
     // We need to trigger something with "withSyn" method, because, otherwise an element won't be found.
     $element->focus();
     $this->processJavaScript($script)->debug([$script]);
     return $session->execute(['script' => str_replace('{{ELEMENT}}', 'arguments[0]', $script), 'args' => [['ELEMENT' => $session->element('xpath', $element->getXpath())->getID()]]]);
 }
開發者ID:arrrtem,項目名稱:TqExtension,代碼行數:20,代碼來源:RawTqContext.php


注:本文中的Behat\Mink\Element\NodeElement::getXpath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。