Resolve the element for a given button by name.

@param  string  $button
@return \Facebook\WebDriver\Remote\RemoteWebElement|null
428191
protected function findButtonByName($button)
    {
        if (! is_null($element = $this->find("input[type=submit][name='{$button}']")) ||
            ! is_null($element = $this->find("input[type=button][value='{$button}']")) ||
            ! is_null($element = $this->find("button[name='{$button}']"))) {
            return $element;
        }
    }
179264
public function get($name)
    {
        if (array_key_exists($name, $this->elements)) {
            return $this->resolveXRef($name);
        }

        return new ElementMissing(null, null);
    }
754307
public function clickToolbarButton($button)
	{
		$input = strtolower($button);

		$screenSize = explode("x", $this->config['window_size']);

		if ($screenSize[0] <= 480)
		{
			$this->click('Toolbar');
		}

		switch ($input)
		{
			case "new":
				$this->click(array('xpath' => "//div[@id='toolbar-new']//button"));
				break;
			case "edit":
				$this->click(array('xpath' => "//div[@id='toolbar-edit']//button"));
				break;
			case "publish":
				$this->click(array('xpath' => "//div[@id='toolbar-publish']//button"));
				break;
			case "unpublish":
				$this->click(array('xpath' => "//div[@id='toolbar-unpublish']//button"));
				break;
			case "archive":
				$this->click(array('xpath' => "//div[@id='toolbar-archive']//button"));
				break;
			case "check-in":
				$this->click(array('xpath' => "//div[@id='toolbar-checkin']//button"));
				break;
			case "batch":
				$this->click(array('xpath' => "//div[@id='toolbar-batch']//button"));
				break;
			case "rebuild":
				$this->click(array('xpath' => "//div[@id='toolbar-refresh']//button"));
				break;
			case "trash":
				$this->click(array('xpath' => "//div[@id='toolbar-trash']//button"));
				break;
			case "save":
				$this->click(array('xpath' => "//div[@id='toolbar-apply']//button"));
				break;
			case "save & close":
				$this->click(array('xpath' => "//div[@id='toolbar-save']//button"));
				break;
			case "save & new":
				$this->click(array('xpath' => "//div[@id='toolbar-save-new']//button"));
				break;
			case "cancel":
				$this->click(array('xpath' => "//div[@id='toolbar-cancel']//button"));
				break;
			case "options":
				$this->click(array('xpath' => "//div[@id='toolbar-options']//button"));
				break;
			case "empty trash":
				$this->click(array('xpath' => "//div[@id='toolbar-delete']//button"));
				break;
		}
	}
1255430
protected static function encodeValue($button)
    {
        if (isset($button['button']) && $button['button'] == 'link') {
            if (substr($button['value'], 0, 7) == 'mailto:') {
                if (version_compare(VERSION . '.' . BUILD, '3.5.5', '>=')) {
                    $button['value'] = \StringUtil::encodeEmail($button['value']);
                } else {
                    $button['value'] = \String::encodeEmail($button['value']);
                }
            } else {
                $button['value'] = ampersand($button['value']);
            }
        }

        return $button;
    }
637572
protected function &findButton($elementname) {
        $form = $this->_form;
        $buttonar =& $form->getElement('buttonar');
        $elements =& $buttonar->getElements();
        foreach ($elements as $el) {
            if ($el->getName() == $elementname) {
                return $el;
            }
        }
        return null;
    }
120366
public function resolveElement(Element $element)
    {
        $elementtype = $this->elementService->findElementtype($element);

        return $this->resolveElementtype($elementtype);
    }
388310
static function laraform($title, $name=null) {
        $el = new ElementButtonTwbs($name, ['value' => $title]);
        $el->addClass('btn');
        return $el;
    }
353541
protected function getForm($button = null)
    {
        // If the first argument isn't a string, that means
        // the user wants us to auto-find the form.

        try {
            if ($button) {
                return $this->crawler->selectButton($button)->form();
            }

            return $this->crawler->filter('form')->form();
        } catch (InvalidArgumentException $e) {
            // We'll catch the exception, in order to provide a
            // more readable failure message for the user.

            throw new InvalidArgumentException(
                "Couldn't find a form that contains a button with text '{$button}'."
            );
        }
    }
265638
private function getReturnTo(Request $request, Button $button)
    {
        $name = $button->getName();
        $isAjax = $request->isXmlHttpRequest();
        if ($request->attributes->has('_test')) {
            return 'test';
        }
        if ($name === 'save') {
            return $isAjax ? 'ajax' : $name;
        }

        return $name;
    }
260373
public function getElement($name)
    {
        $element = $this->createElement($name);

        if (!$this->has('xpath', $element->getXpath())) {
            throw new ElementNotFoundException(sprintf('"%s" element is not present on the page', $name));
        }

        return $element;
    }
812966
public function setWebButton(OneSignalWebButton $button)
    {
        return $this->setParameter('web_buttons', array_merge($this->getParameter('web_buttons', []), [$button->toArray()]));
    }
80690
public function addButton($button)
    {
        $buttons = $this->buttons;

        // If buttons isn't an array, set it
        if (!is_array($buttons)) {
            $buttons = array();
        }

        $buttons[] = $button;

        $this->buttons = $buttons;

        return $this;
    }
438348
public function &getElementByName( $name )
	{
		$defaultResult = array();

		if ( ! property_exists( $this, 'elements_by_name' ) )
		{
			$this->elements_by_name = array();

			foreach ( $this->elementIndex as $elementsKey => &$element )
			{
				$this->elements_by_name[ $element['name'] ]  = &$element;
			}
		}

		if ( isset( $this->elements_by_name[ $name ] ) )
		{
			return $this->elements_by_name[ $name ];
		}
		return $defaultResult;

		return isset( $this->elements_by_name[ $name ] ) ? $this->elements_by_name[ $name ] : $defaultResult;
	}
598667
public function resolve($name)
    {
        $name = array_key_exists($name, $this->aliasMap) ? $this->aliasMap[$name] : $name;

        return $this->a->resolve($name);
    }
469106
public function getButton($name, $need = TRUE)
    {
        return $this->hasButtons()
            ? $this->getComponent(Button::ID)->getComponent($name, $need)
            : NULL;
    }
1117560
public function get($name)
    {
        if ($this->has($name)) {
            $code = $this->getCode($name);

            $this->elements[$code] = $this->resolve($this->elements[$code]);

            return $this->elements[$code];
        }

        throw new \InvalidArgumentException(sprintf('Element "%s" does not exist.', $name));
    }
854474
public function addButtonReset(string $name) : Element\Button\Reset
    {
        $button = new Element\Button\Reset($this, $name);
        $this->addComponent($name, $button);

        return $button;
    }