当前位置: 首页>>代码示例>>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;未经允许,请勿转载。