本文整理汇总了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);
}
示例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];
}
示例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);
}
示例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');
}
示例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;
}
示例6: findCommentMessage
/**
* @param NodeElement $element
*
* @return NodeElement|mixed|null
*/
protected function findCommentMessage(NodeElement $element)
{
return $element->find('css', 'span.message');
}
示例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;
}
示例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();
}
示例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}]");
}
示例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();
}
示例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));
}
示例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;
}
示例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);
}
示例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();
}
示例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');
}
}