{@inheritdoc}

@throws ElementNotFoundException
162959
public function checkValidationMessageFor($element, $message)
    {
        $foundElement = $this->getFieldElement($element);
        if (null === $foundElement) {
            throw new ElementNotFoundException($this->getSession(), 'Validation message', 'css', '.sylius-validation-error');
        }

        $validationMessage = $foundElement->find('css', '.sylius-validation-error');
        if (null === $validationMessage) {
            throw new ElementNotFoundException($this->getSession(), 'Validation message', 'css', '.sylius-validation-error');
        }

        return $message === $validationMessage->getText();
    }
469548
protected function find(string $name)
    {
        foreach ($this->elements as $element) {
            if ($element instanceof NamedInterface && $element->getName() == $name) {
                return $element;
            }
        }

        throw new ReactorException("Unable to find element '{$name}'");
    }
772213
public function getElement ($key, $elementType)
    {
        $elements = $this->getAllElements($elementType);

        return array_key_exists($key, $elements)
            ? $elements[$key]
            : null;
    }
10410
protected function getInvalidFieldsetElements(ElementInterface $element, FieldsetInterface $fieldset)
    {
        $elementName = $this->normalizeElementName($element->getName());
        $elements = $fieldset->getElements();

        if (isset($elements[$elementName]) && $elements[$elementName] === $element) {
            if ($fieldset->getMessages()) {
                return $elements;
            }

            /* @var $fieldsetElement ElementInterface */
            foreach ($elements as $fieldsetElement) {
                if ($fieldsetElement->getMessages()
                    && ($fieldsetElement->getAttribute('type') === 'hidden'
                        || $fieldsetElement instanceof Element\Captcha)
                ) {
                    return $elements;
                }
            }
        }

        foreach ($fieldset->getFieldsets() as $fieldsetElement) {
            if ($elements = $this->getInvalidFieldsetElements($element, $fieldsetElement)) {
                return $elements;
            }
        }

        return [];
    }
241450
private function processElement( $elements )
	{
		foreach ( $elements as $name => $value )
		{
			if ( $value->count() ) continue;

			if ( ! property_exists( $this, $name ) ) continue;
			$this->$name = (string)$value;
		}
	}
1372793
private function getValueFromKey($element, $key)
    {
        if ((is_object($element) && !$this->getValueKeyFromObject($element, $key)) || (is_array($element) && !isset($element[$key]))) {
            $getterName = 'get'.str_replace(' ', '', ucwords($key));

            throw new NotValidKeyElementInListException($key.' is not a valid key. If your elements are Entities class, please check if you implement '.$getterName.'() method.');
        }

        return is_object($element) ? $this->getValueKeyFromObject($element, $key) : $element[$key];
    }
681886
public function waitUntilElementIsVisible(string $cssSelector, int $timeout = 5, TraversableElement $baseElement = null): void
    {
        $baseElement = $baseElement ?? $this->getSession()->getPage();

        try {
            $this->waitUntil($timeout, function () use ($cssSelector, $baseElement) {
                $element = $baseElement->find('css', $cssSelector);

                return isset($element) && $element->isVisible();
            });
        } catch (Exception $e) {
            throw new ElementNotVisible(sprintf('Element with selector: %s was not found', $cssSelector));
        }
    }
1053346
function initHandlerCustom( $element, &$params )
    {
        if ( $this->XMLSchema->isInline( $element ) )
            return null;

        $this->elementStylesToAttribute( $element );
        return null;
    }
374856
protected function elementNotFound($type, $selector = null, $locator = null)
    {
        @trigger_error(sprintf('The method %s is deprecated as of 1.7 and will be removed in 2.0', __METHOD__), E_USER_DEPRECATED);

        return new ElementNotFoundException($this->driver, $type, $selector, $locator);
    }
944569
public function update(string $key, $oldValue, $newValue, AbstractElement $element)
	{
		if (!isset($this->index[$key])) {
			throw new MissingAttrIndexException("Attribute index \"$key\" is not defined.");
		}

		$id = $element->getId();

		if (isset($this->index[$key][$oldValue][$id])) {
			unset($this->index[$key][$oldValue][$id]);
		} else {
			throw new MissingElementException("Old value of \"$id\" is not indexed.");
		}

		$this->index[$key][$newValue][$id] = $element;
	}
600333
private function findHiddenField($field)
    {
        $node = $this->getSession()->getPage()->find(
            'xpath',
            strtr(
                ".//input[./@type = 'hidden'][(./@id = '%locator%' or ./@name = '%locator%')]",
                array('%locator%' => $field)
            )
        );
        if (null === $node) {
            throw new ElementNotFoundException($this->getSession(), 'hidden field', 'id|name', $field);
        }

        return $node;
    }
7312
public function get_element($elementname) {
        if ($this->_form->elementExists($elementname)) {
            return $this->_form->getElement($elementname);
        } else {
            return false;
        }
    }
1343657
public function render(ElementInterface $element)
    {
        if (!$element instanceof SelectElement) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s requires that the element is of type Zend\Form\Element\Select',
                __METHOD__
            ));
        }

        $name   = $element->getName();
        if (empty($name) && $name !== 0) {
            throw new Exception\DomainException(sprintf(
                '%s requires that the element has an assigned name; none discovered',
                __METHOD__
            ));
        }

        $options = $element->getValueOptions();

        if (($emptyOption = $element->getEmptyOption()) !== null) {
            $options = array('' => $emptyOption) + $options;
        }

        $attributes = $element->getAttributes();
        $value      = $this->validateMultiValue($element->getValue(), $attributes);

        $attributes['name'] = $name;
        if (array_key_exists('multiple', $attributes) && $attributes['multiple']) {
            $attributes['name'] .= '[]';
        }
        $this->validTagAttributes = $this->validSelectAttributes;

        $figlet =  sprintf(
            '<div %s>
				<button class="btn btn-primary" type="button">' . $element->getLabel() . '</button>
				<button data-toggle="dropdown" class="btn btn-primary dropdown-toggle" type="button"><span class="caret"></span></button>
				<ul class="dropdown-menu">
        			%s
        		</ul>
			</div>',
			$this->createAttributesString($attributes),
            $this->renderOptions($options, $value)
        );

        $separator = $this->getSeparator();

        $captchaInput = $this->renderInputs($element);
        
        $pattern = '%s%s%s';
        return sprintf($pattern, $figlet, $separator, $captchaInput);
    }
146011
public function getElements(By $by, Element $element = null)
    {
        try {
            $obj = null === $element ? $this->getBrowser() : $element;

            return $obj->elements($by);
        } catch (ExceptionInterface $e) {
            throw new \RuntimeException(sprintf('Error while searching for element "%s" : %s (visible text: "%s").', $by->toString(), $e->getMessage(), $this->getBrowser()->getText()));
        }
    }
630230
public function create($element, $inputType = null, $position = null)
    {
        if (!(is_string($element) || $element instanceof FormElement)) {
            throw new Exception('$element must be string or FormElement instance.');
        }

        // Create new element from string declaration ("title").
        if (is_string($element)) {
            $element = (new FormElement($element));
        }

        // Create Form Input Element from string declaration ("textarea")
        if (is_string($inputType)) {
            $oldInput = $element->getInput();
            $newInput = InputFactory::make($element->id(), $inputType);

            $newInput->setRelation(
                $oldInput->getRelation()
            )->setTranslatable(
                $oldInput->getTranslatable()
            );

            $element->setInput(
                $newInput
            );
        }

        // Allow a callable input type.
        if (is_callable($inputType)) {
            call_user_func_array($inputType, [$element]);
        }

        if (is_numeric($position)) {
            return $this->insert($element, $position);
        }

        // Push element
        $this->push($element);

        if (null !== $position) {
            return $this->move($element->id(), $position);
        }

        return $this;
    }
120366
public function resolveElement(Element $element)
    {
        $elementtype = $this->elementService->findElementtype($element);

        return $this->resolveElementtype($elementtype);
    }
453008
public function addElement($element) : SidebarBuilderEvent
    {
        if (!is_array($element)) {
            return $this;
        }

        if (!array_key_exists('key', $element)) {
            foreach ($element as $subElement) {
                $this->addElement($subElement);
            }
        } elseif (array_key_exists($element['key'], $this->sidebar['admin'])) {
            if (!array_key_exists('children', $element)) {
                throw new \UnexpectedValueException('no children found for key ' . $element['key']);
            }
            $this->sidebar['admin'][$element['key']]['children'] = array_merge($this->sidebar['admin'][$element['key']]['children'], $element['children']);
        } else {
            $this->sidebar['admin'][$element['key']] = $element;
        }

        return $this;
    }