Asserts that the elements exists in the DOM and is visible to the user.

@return $this
@throws \Facebook\WebDriver\Exception\NoSuchElementException
@throws \Facebook\WebDriver\Exception\TimeOutException
505970
public function toBeVisible()
    {
        $this->wait()->until(WebDriverExpectedCondition::visibilityOfElementLocated($this->elementFinder->getSearchCriteria()));

        return $this;
    }
1311761
public function isSelected($xpath) {
    $elements = $this->findElement($xpath, 1);
    $javascript = $this->javascriptTemplateRender("is_selected.js.twig", array("xpath" => $xpath));
    $tagName = $this->browser->tagName($elements["page_id"], $elements["ids"][0]);
    if (strcmp(strtolower($tagName), "option") !== 0) {
      throw new DriverException("Can not assert on element that is not an option");
    }

    return $this->browser->evaluate($javascript);
  }
483580
public function logOut()
    {
        /*
         * Using NodeElement::mouseOver() won't work because WordPress is using hoverIndent.
         * Instead we just manually add the hover class.
         *
         * See https://github.com/paulgibbs/behat-wordpress-extension/issues/65
         */
        try {
            $element_exists = $this->getSession()->evaluateScript(
                'return document.getElementById("wp-admin-bar-my-account");'
            );

            if ($element_exists !== null) {
                $this->getSession()->executeScript(
                    'document.getElementById("wp-admin-bar-my-account").classList.add("hover");'
                );

                $this->find('css', '#wp-admin-bar-logout a')->click();
            }
        } catch (UnsupportedDriverActionException $e) {
            // This will fail for GoutteDriver but neither is it necessary.
            $this->find('css', '#wp-admin-bar-logout a')->click();
        }
    }
644673
public function loadDefaultElements()
    {
        $this->getOrganizationElement();
        $this->getUserNameElement();
        $this->getSubmitButton();
        $this->getLoginLinkElement();

        return $this;
    }
44767
public function before()
    {
        $this->importNodes(\func_get_args(), function ($node, $imported_node) {
            if ($node->parentNode instanceof \DOMDocument) {
                throw new \Exception('Can not set before root element '.$node->tagName.' of document');
            }

            $node->parentNode->insertBefore($imported_node, $node);
        });

        return $this;
    }
1102397
public function elementShouldBeVisible($selector)
    {
        $session = $this->getSession();
        $page = $session->getPage();
        $element = $page->find('css', $selector);

        if (!$element) {
            throw new ElementNotFoundException($session, 'Element "'.$selector.'"');
        }

        \PHPUnit_Framework_TestCase::assertTrue($element->isVisible());
    }
275484
public function validate() {

		// check whether a CSRF token was tainted
		
		if($this->enableCsrfToken && !$this->checkCsrfToken()) {

			throw new HtmlFormException('CSRF token mismatch.', HtmlFormException::CSRF_TOKEN_MISMATCH);

		}

		$this->formErrors = [];

		foreach($this->elements as $name => $e) {
			
			if(is_array($e)) {
				foreach($e as $ndx => $elem) {
				    if(!$elem->isValid()) {
                        if (!isset($this->formErrors[$name])) {
                            $this->formErrors[$name] = [];
                        }
                        $this->formErrors[$name][$ndx] = new FormError($elem->getValidationErrorMessage());
                    }
				}
			}

			else if(!$e->isValid()) {
				$this->formErrors[$name] = new FormError($e->getValidationErrorMessage());
			}
		}

		return $this;

	}
1373340
public function setElement($element = null)
    {
        $this->element = null;

        if (!$element = $this->internalResolveElement($element)) {
            $this->element = $this->elementId = null;
        } else {
            /** @var Element $element */
            $this->elementId = $element->id;
            $this->element = $element;
        }

        return $this;
    }
823760
protected function ensureAppended()
    {
        if (!$this->_appended) {
            $this->_parentElement->getDOM()->appendChild($this->_element);
            $this->_appended = true;
            $this->_parentElement->ensureAppended();
        }
    }
1106532
public function getElements()
    {
        foreach ($this->elements as $name => $element) {
            $this->resolveXRef($name);
        }

        return $this->elements;
    }
1240592
public function current()
    {
        $k = key($this->ids);
        if (null === $k) {
            return false;
        }

        if (count($this->ids) == 1) {
            return $this;
        }

        if (!isset($this->_ich[$k])) {
            $this->_ich[$k] = new self($this->doc, array($k => $this->ids[$k]));
        }

        return $this->_ich[$k];
    }
1284080
public function noWait()
	{
		$this->type = 'noWait';

		if ($this->noWait === null)
		{
			$this->noWait = new QueryElement('NOWAIT', null);
		}

		return $this;
	}
405243
protected function SaveElement()
    {
        $this->confirm->SetErrorUrl($this->selectorError->Save($this->confirm->GetErrorUrl()));
        $this->confirm->SetSuccessUrl($this->selectorSuccess->Save($this->confirm->GetSuccessUrl()));
        return $this->confirm;
    }
345606
public function setInactiveAll() {
		foreach ($this->getElements() as $element) {
			if ($element instanceof Element) {
				$element->setInactive();
			}
		}
		
		return $this;
	}
1206062
public function toBeSelected()
    {
        $this->wait()->until(WebDriverExpectedCondition::elementToBeSelected($this->elementFinder->getSearchCriteria()));

        return $this;
    }
1309236
protected function SaveElement()
    {
        $this->logout->SetNextUrl($this->selectorNext->Save($this->logout->GetNextUrl()));
        return $this->logout;
    }
854470
private function __validate()
    {
        $blnReturn = true;

        foreach ($this->__elements as $element) {
            if (! $element->isValid()) {
                $blnReturn = false;
                break;
            }
        }

        return $blnReturn;
    }