本文整理匯總了PHP中Magento\Mtf\Client\Element\SimpleElement::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP SimpleElement::find方法的具體用法?PHP SimpleElement::find怎麽用?PHP SimpleElement::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Mtf\Client\Element\SimpleElement
的用法示例。
在下文中一共展示了SimpleElement::find方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getRatingVote
/**
* Get rating vote
*
* @param SimpleElement $rating
* @return int
*/
protected function getRatingVote(SimpleElement $rating)
{
$ratingVote = 5;
$ratingVoteElement = $rating->find(sprintf($this->checkedRating, $ratingVote));
while (!$ratingVoteElement->isVisible() && $ratingVote) {
--$ratingVote;
$ratingVoteElement = $rating->find(sprintf($this->checkedRating, $ratingVote));
}
return $ratingVote;
}
示例2: fillFormTab
/**
* Fill condition options
*
* @param array $fields
* @param SimpleElement|null $element
* @return void
*/
public function fillFormTab(array $fields, SimpleElement $element = null)
{
$data = $this->dataMapping($fields);
$conditionsBlock = Factory::getBlockFactory()->getMagentoCatalogRuleConditions($element->find($this->ruleConditions));
$conditionsBlock->clickAddNew();
$conditionsBlock->selectCondition($data['condition_type']['value']);
$conditionsBlock->clickEllipsis();
$conditionsBlock->selectConditionValue($data['condition_value']['value']);
}
示例3: getDataOptions
/**
* Get data options from 'Tier price' form.
*
* @param array $fields
* @param SimpleElement|null $element
* @return array
*/
public function getDataOptions(array $fields = null, SimpleElement $element = null)
{
$data = [];
if (isset($fields['value']) && is_array($fields['value'])) {
foreach ($fields['value'] as $key => $option) {
$data[$key++] = parent::getDataOptions($option, $element->find('tbody tr:nth-child(' . $key . ')'));
}
}
return $data;
}
示例4: fillFormTab
/**
* Fill data to labels fields on labels tab.
*
* @param array $fields
* @param Element|null $element
* @return $this
*/
public function fillFormTab(array $fields, Element $element = null)
{
if (isset($fields['store_labels'])) {
$count = 0;
foreach ($fields['store_labels']['value'] as $storeLabel) {
$element->find(sprintf(self::STORE_LABEL_NAME, $count))->setValue($storeLabel);
++$count;
}
}
return $this;
}
示例5: fillFormTab
/**
* Fill data to fields on tab
*
* @param array $fields
* @param SimpleElement|null $element
* @return $this
*/
public function fillFormTab(array $fields, SimpleElement $element = null)
{
if (isset($fields['grouped_products'])) {
foreach ($fields['grouped_products']['value'] as $groupedProduct) {
$element->find($this->addNewOption)->click();
$searchBlock = $this->getSearchGridBlock();
$searchBlock->searchAndSelect($groupedProduct['search_data']);
$searchBlock->addProducts();
$this->getListAssociatedProductsBlock()->fillProductOptions($groupedProduct['data']);
}
}
return $this;
}
示例6: fillFormTab
/**
* Fill data to fields on tab
*
* @param array $fields
* @param SimpleElement|null $element
* @return $this
*/
public function fillFormTab(array $fields, SimpleElement $element = null)
{
if (isset($fields['associated'])) {
$options = $this->_rootElement->getElements($this->deleteButton);
if (count($options)) {
foreach (array_reverse($options) as $option) {
$option->click();
}
}
foreach ($fields['associated']['value']['assigned_products'] as $key => $groupedProduct) {
$element->find($this->addNewOption)->click();
$searchBlock = $this->getSearchGridBlock();
$searchBlock->searchAndSelect(['name' => $groupedProduct['name']]);
$searchBlock->addProducts();
$this->getListAssociatedProductsBlock()->fillProductOptions($groupedProduct, $key + 1);
}
}
return $this;
}
示例7: getRequestDetails
/**
* Return request details.
*
* @param SimpleElement $context
* @return array
*/
protected function getRequestDetails(SimpleElement $context)
{
$mapping = $this->dataMapping();
$mappingDetails = $mapping['details']['value'];
$data = [];
unset($mappingDetails['composite']);
foreach ($mappingDetails as $fieldName => $locator) {
$element = $context->find($locator['selector'], $locator['strategy']);
if ($element->isVisible()) {
$data[$fieldName] = trim($element->getText());
}
}
if (isset($data['entity_id'])) {
$data['entity_id'] = str_replace('#', '', $data['entity_id']);
}
if (isset($data['order_id'])) {
$data['order_id'] = str_replace('#', '', $data['order_id']);
}
return $data;
}
示例8: getOptionNotice
/**
* Get notice of option by number.
*
* @param Element $option
* @param int $number
* @return mixed
*/
protected function getOptionNotice(Element $option, $number)
{
$note = $option->find(sprintf($this->noteByNumber, $number), Locator::SELECTOR_XPATH);
return $note->isVisible() ? $note->getText() : null;
}
示例9: fillFormTab
/**
* Fill data to content fields on content tab.
*
* @param array $fields
* @param SimpleElement|null $element
* @return $this
*/
public function fillFormTab(array $fields, SimpleElement $element = null)
{
$element->find($this->content)->setValue($fields['content']['value']['content']);
if (isset($fields['content_heading']['value'])) {
$element->find($this->contentHeading)->setValue($fields['content_heading']['value']);
}
if (isset($fields['content']['value']['widget']['dataset'])) {
foreach ($fields['content']['value']['widget']['dataset'] as $widget) {
$this->clickInsertWidget();
$this->getWidgetBlock()->addWidget($widget);
}
}
if (isset($fields['content']['value']['variable'])) {
$this->clickInsertVariable();
$config = $this->getWysiwygConfig();
$config->selectVariableByName($fields['content']['value']['variable']);
}
return $this;
}
示例10: clickPayNow
/**
* Click "Pay Now" button.
*
* @param SimpleElement $element
* @return void
*/
public function clickPayNow(SimpleElement $element)
{
$element->find($this->continue)->click();
$this->browser->selectWindow();
}
示例11: getOptionalFields
/**
* Get optional fields
*
* @param SimpleElement $context
* @param array $fields
* @return array
*/
protected function getOptionalFields(SimpleElement $context, array $fields = [])
{
$data = [];
$fields = empty($fields) ? $this->mappingGetFields : $fields;
foreach ($fields as $name => $params) {
$data[$name] = $context->find($params['selector'], $params['strategy'])->getText();
}
return $data;
}
示例12: getNoticeLabel
/**
* Get label for notice message.
*
* @param Element $element
* @return string
*/
protected function getNoticeLabel(Element $element)
{
$noticeLabel = str_replace(' ', '', strtolower($element->find($this->noticeLabel, Locator::SELECTOR_XPATH)->getText()));
return str_replace('*', '', $noticeLabel);
}
示例13: checkHtmlTagStructure
/**
* Find <tag1><tag2><tagN> ... </tagN></tag2></tag1> tag structure in element.
*
* @param SimpleElement $element
* @param string $selector
* @return SimpleElement
*/
protected function checkHtmlTagStructure(SimpleElement $element, $selector)
{
return $element->find($selector);
}
示例14: getPriceFromPage
/**
* Get price from page.
*
* @param SimpleElement $infoBlock
* @param string $currency
* @param string $selector
* @return string
*/
protected function getPriceFromPage(SimpleElement $infoBlock, $currency, $selector)
{
return $this->preparePrice($infoBlock->find($selector, Locator::SELECTOR_XPATH)->getText(), $currency);
}
示例15: getSubOptions
/**
* Get sub options.
*
* @param Element $element
* @return array
*/
protected function getSubOptions(Element $element)
{
$optionType = $element->find($this->checkedOptionType)->getText();
$optionType = str_replace([' ', '&', '-'], '', $optionType);
return $this->getSubOptionsBlock($optionType, $element)->getOptions();
}