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


PHP NodeElement::find方法代碼示例

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


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

示例1: getNameProperty

 /**
  * Returns the name
  * @param NodeElement $slide
  * @return string
  */
 public function getNameProperty(NodeElement $slide)
 {
     $selectors = Helper::getRequiredSelectors($this, ['slideImage', 'slideLink', 'slideName']);
     $nameElement = $slide->find('css', $selectors['slideName']);
     $names = ['imageAlt' => $slide->find('css', $selectors['slideImage'])->getAttribute('alt'), 'linkTitle' => $slide->find('css', $selectors['slideLink'])->getAttribute('title'), 'name' => $nameElement->getText(), 'nameTitle' => $nameElement->getAttribute('title')];
     return Helper::getUnique($names);
 }
開發者ID:BucherStoerzbachGbR,項目名稱:shopware,代碼行數:12,代碼來源:ArticleSlider.php

示例2: getScopeData

 /**
  * @param NodeElement $scopeBlock
  *
  * @return array
  */
 protected function getScopeData(NodeElement $scopeBlock)
 {
     $ratio = $scopeBlock ? $scopeBlock->find('css', '.literal-progress')->getHtml() : '';
     $state = $scopeBlock ? explode('-', $scopeBlock->find('css', '.progress')->getAttribute('class'))[1] : '';
     $missingValuesBlocks = $scopeBlock ? $scopeBlock->findAll('css', '.missing-attributes [data-attribute]') : [];
     $missingValues = [];
     if (!empty($missingValuesBlocks)) {
         foreach ($missingValuesBlocks as $missingValuesBlock) {
             $attributeCode = $missingValuesBlock->getAttribute('data-attribute');
             $attributeLabel = $missingValuesBlock->getHtml();
             $missingValues[$attributeCode] = $attributeLabel;
         }
     }
     return ['ratio' => $ratio, 'state' => $state, 'missing_values' => $missingValues];
 }
開發者ID:a2xchip,項目名稱:pim-community-dev,代碼行數:20,代碼來源:PanelDecorator.php

示例3: createFromNode

 public static function createFromNode(NodeElement $node)
 {
     $message = $node->find('css', '.noty_text')->getHtml();
     //$x = $node->getOuterHtml();
     $class = $node->getAttribute('class');
     switch ($class) {
         case 'noty_alert':
             $type = 'alert';
             break;
         case 'noty_warning':
             $type = 'warning';
             break;
         case 'noty_error':
             $type = 'error';
             break;
         case 'noty_information':
             $type = 'information';
             break;
         case 'noty_success':
             $type = 'success';
             break;
         default:
             $type = 'default';
     }
     return new NotyMessage($node, $type, $message);
 }
開發者ID:dafik,項目名稱:cc-tests-reverse,代碼行數:26,代碼來源:NotyMessage.php

示例4: selectable

 /**
  * Ensure option is selected.
  */
 public function selectable()
 {
     $this->restrictElements(['select' => []]);
     $data = [$this->value, $this->element->find('xpath', "//option[@value='{$this->value}']")->getText()];
     self::debug(['Expected: %s', 'Value: %s', 'Tag: %s'], [$this->expected, implode(' => ', $data), $this->tag]);
     $this->assert(in_array($this->expected, $data), 'selected');
 }
開發者ID:BR0kEN-,項目名稱:TqExtension,代碼行數:10,代碼來源:FormValueAssertion.php

示例5: getOrderPositionData

 /**
  * Helper function returns the data of an order position
  * @param NodeElement $position
  * @param string[] $selectors
  * @return array
  */
 private function getOrderPositionData(NodeElement $position, array $selectors)
 {
     $data = [];
     foreach ($selectors as $key => $selector) {
         $element = $position->find('css', $selector);
         $data[$key] = $element->getText();
         if ($key !== 'product') {
             $data[$key] = Helper::floatValue($data[$key]);
         }
     }
     return $data;
 }
開發者ID:BucherStoerzbachGbR,項目名稱:shopware,代碼行數:18,代碼來源:AccountOrder.php

示例6: findCommentMessage

 /**
  * @param NodeElement $element
  *
  * @return NodeElement|mixed|null
  */
 protected function findCommentMessage(NodeElement $element)
 {
     return $element->find('css', 'span.message');
 }
開發者ID:noglitchyo,項目名稱:pim-community-dev,代碼行數:9,代碼來源:Edit.php

示例7: is_moodleform_field

 /**
  * Detects when the field is a moodleform field type.
  *
  * Note that there are fields inside moodleforms that are not
  * moodleform element; this method can not detect this, this will
  * be managed by get_field_node_type, after failing to find the form
  * element element type.
  *
  * @param NodeElement $fieldnode
  * @return bool
  */
 protected static function is_moodleform_field(NodeElement $fieldnode)
 {
     // We already waited when getting the NodeElement and we don't want an exception if it's not part of a moodleform.
     $parentformfound = $fieldnode->find('xpath', "/ancestor::form[contains(concat(' ', normalize-space(@class), ' '), ' mform ')]");
     return $parentformfound != false;
 }
開發者ID:janeklb,項目名稱:moodle,代碼行數:17,代碼來源:behat_field_manager.php

示例8: getTextProperty

 /**
  * Returns the text preview of the blog article
  * @param NodeElement $article
  * @return null|string
  */
 public function getTextProperty(NodeElement $article)
 {
     $selector = Helper::getRequiredSelector($this, 'articleText');
     return $article->find('css', $selector)->getText();
 }
開發者ID:BucherStoerzbachGbR,項目名稱:shopware,代碼行數:10,代碼來源:BlogArticle.php

示例9: getParentWithAttribute

 /**
  * @param NodeElement $element
  * @param string $attribute
  * @param string $value
  *
  * @return NodeElement|null
  */
 public function getParentWithAttribute($element, $attribute, $value = '')
 {
     $attribute = empty($value) ? "@{$attribute}" : "contains(@{$attribute}, '{$value}')";
     return $element->find('xpath', "/ancestor::*[{$attribute}]");
 }
開發者ID:arrrtem,項目名稱:TqExtension,代碼行數:12,代碼來源:RawPageContext.php

示例10: user_clicks_on_management_listing_action

 /**
  * Finds the node to use for a management listitem action and clicks it.
  *
  * @param string $listingtype Either course or category.
  * @param \Behat\Mink\Element\NodeElement $listingnode
  * @param string $action The action being taken
  * @throws Behat\Mink\Exception\ExpectationException
  */
 protected function user_clicks_on_management_listing_action($listingtype, $listingnode, $action)
 {
     $actionsnode = $listingnode->find('xpath', "//*[contains(concat(' ', normalize-space(@class), ' '), '{$listingtype}-item-actions')]");
     if (!$actionsnode) {
         throw new ExpectationException("Could not find the actions for {$listingtype}", $this->getSession());
     }
     $actionnode = $actionsnode->find('css', '.action-' . $action);
     if (!$actionnode) {
         throw new ExpectationException("Expected action was not available or not found ({$action})", $this->getSession());
     }
     if ($this->running_javascript() && !$actionnode->isVisible()) {
         $actionsnode->find('css', 'a.toggle-display')->click();
         $actionnode = $actionsnode->find('css', '.action-' . $action);
     }
     $actionnode->click();
 }
開發者ID:MoodleMetaData,項目名稱:MoodleMetaData,代碼行數:24,代碼來源:behat_course.php

示例11: getPriceProperty

 /**
  * Returns the price
  * @param NodeElement $slide
  * @return float
  */
 public function getPriceProperty(NodeElement $slide)
 {
     $selector = Helper::getRequiredSelector($this, 'slidePrice');
     preg_match('(\\d+,\\d{2})', $slide->find('css', $selector)->getHtml(), $price);
     return Helper::floatValue(current($price));
 }
開發者ID:GerDner,項目名稱:luck-docker,代碼行數:11,代碼來源:ArticleSlider.php

示例12: getDeleteButtonForCollectionItem

 /**
  * @param NodeElement $item
  *
  * @return NodeElement
  *
  * @throws ElementNotFoundException
  */
 private function getDeleteButtonForCollectionItem(NodeElement $item)
 {
     $deleteButton = $item->find('css', 'a[data-form-collection="delete"]');
     if (null === $deleteButton) {
         throw new ElementNotFoundException($this->getDriver(), 'link', 'css', 'a[data-form-collection="delete"]');
     }
     return $deleteButton;
 }
開發者ID:NeverResponse,項目名稱:Sylius,代碼行數:15,代碼來源:UpdatePage.php

示例13: getPriceProperty

 /**
  * Returns the price
  * @param NodeElement $slide
  * @return float
  */
 public function getPriceProperty(NodeElement $slide)
 {
     $selector = Helper::getRequiredSelector($this, 'slidePrice');
     $price = $slide->find('css', $selector)->getText();
     return Helper::floatValue($price);
 }
開發者ID:BucherStoerzbachGbR,項目名稱:shopware,代碼行數:11,代碼來源:ArticleSlider.php

示例14: getSlideProperty

 /**
  * Default method to get a slide property
  * @param NodeElement $slide
  * @param string $property
  * @return null|string
  */
 public function getSlideProperty(NodeElement $slide, $property)
 {
     $selector = Helper::getRequiredSelector($this, 'slide' . $property);
     return $slide->find('css', $selector)->getText();
 }
開發者ID:GerDner,項目名稱:luck-docker,代碼行數:11,代碼來源:SliderElement.php

示例15: openFilter

 /**
  * Open the filter
  *
  * @param NodeElement $filter
  *
  * @throws \InvalidArgumentException
  */
 public function openFilter(NodeElement $filter)
 {
     if ($element = $filter->find('css', 'button')) {
         $element->click();
     } else {
         throw new \InvalidArgumentException('Impossible to open filter or maybe its type is not yet implemented');
     }
 }
開發者ID:bengrol,項目名稱:pim-community-dev,代碼行數:15,代碼來源:Grid.php


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