Continuously poll the page, until you find an element
with the given name or id.

@param  string  $element
@param  integer $timeout
@return static
349151
public function waitForElement($element, $timeout = 5000)
    {
        $this->session->timeouts()->postImplicit_wait(['ms' => $timeout]);

        try {
            $this->findByNameOrId($element);
        } catch (InvalidArgumentException $e) {
            throw new InvalidArgumentException(
                "Hey, what's happening... Look, I waited {$timeout} milliseconds to see an element with " .
                "a name or id of '{$element}', but no luck. \nIf you could take a look, that'd be greaaattt..."
            );
        }

        return $this;
    }
538355
def wait_for_element_visible(self, selector, by=By.CSS_SELECTOR,
                                 timeout=settings.LARGE_TIMEOUT):
        
        if page_utils.is_xpath_selector(selector):
            by = By.XPATH
        if page_utils.is_link_text_selector(selector):
            selector = page_utils.get_link_text_from_selector(selector)
            by = By.LINK_TEXT
        return page_actions.wait_for_element_visible(
            self.driver, selector, by, timeout)
112388
public function waitForAlert($timeout = 60)
	{
		$result = FALSE;
		$i = 0;
		do
		{
			sleep(1);
			try
			{
				$result = $this->alertText();
			}
			catch (\RuntimeException $e)
			{
				;
			}
		} while (++$i < $timeout && $result === FALSE);
		return $result;
	}
576160
public function hasElementBy($by, $value, $timeout = self::TIMEOUT_ELEMENT_COUNT)
    {
        $lastTimeout = $this->timeouts()->getLastImplicitWaitValue();

        $this->timeouts()->implicitWait($timeout);

        $has = $this->countElementsBy($by, $value) > 0;

        $this->timeouts()->implicitWait($lastTimeout);

        return $has;
    }
193980
public function clickDisplayedElementByClass($value, $timeout = 0)
    {
        return $this->clickDisplayedElement(self::BY_CLASS_NAME, $value, $timeout, $timeout);
    }
233779
public function block($timeout, $callback = null)
    {
        $starting = time();

        $id = Str::random(20);

        while (! $slot = $this->acquire($id)) {
            if (time() - $timeout >= $starting) {
                throw new LimiterTimeoutException;
            }

            usleep(250 * 1000);
        }

        if (is_callable($callback)) {
            try {
                return tap($callback(), function () use ($slot, $id) {
                    $this->release($slot, $id);
                });
            } catch (Exception $exception) {
                $this->release($slot, $id);

                throw $exception;
            }
        }

        return true;
    }
115638
public function setTimeout($timeout) {
            $this->timeout = $timeout;
            $this->process->setTimeout($this->timeout);
            return $this;
        }
417415
public function timeout($timeout = null)
    {
        // Return value
        if (empty($timeout)) {
            return $this->timeout;
        }

        // Set value
        $this->timeout = $timeout;

        return $this;
    }
223068
public function setTimeout($timeout)
    {
        if (null === $timeout) {
            $this->timeout = null;

            return $this;
        }

        $timeout = (float) $timeout;

        if ($timeout < 0) {
            throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
        }

        $this->timeout = $timeout;

        return $this;
    }
77149
protected function findByNameOrId($name, $element = '*')
    {
        $name = str_replace('#', '', $name);

        try {
            return $this->session->element('css selector', "#{$name}, *[name={$name}]");
        } catch (NoSuchElement $e) {
            throw new InvalidArgumentException(
                "Couldn't find an element, '{$element}', with a name or class attribute of '{$name}'."
            );
        }
    }
644274
public static function setTimeout($id, $timeout = null)
    {
        if (isset(self::$list[$id])) {
            self::$list[$id]->timeout($timeout);
            return true;
        }
        return false;
    }
732179
function setCallVoteTimeOut($timeout, $multicall = false)
    {
        if (!is_int($timeout)) {
            throw new InvalidArgumentException('timeout = ' . print_r($timeout, true));
        }

        return $this->execute(ucfirst(__FUNCTION__), array($timeout), $multicall);
    }
365437
public function waitForCondition($jsCondition, $timeout = 60)
	{
		$i = 0;
		do
		{
			sleep(1);
		} while (
			!($result = $this->execute(array('script' => 'return ' . $jsCondition, 'args' => array())))
			&& $i++ < $timeout
		);
		return $result;
	}
552230
public function set($key, $value, $timeout = 0)
    {
        if (is_int($timeout) && $timeout > 0) {
            $this->driver->set($key, (string)$value, $timeout);
        } else {
            $this->driver->set($key, (string)$value);
        }
    }
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));
        }
    }
577188
protected function waitForElement($type, $value, $timeout)
    {
        if (!in_array($type, $this->waitForTypes)) {
            throw new \Exception('Invalid wait for element type to wait for on the page');
        }

        $webdriver = $this;
        $this->waitUntil(function () use ($type, $value, $webdriver) {
            $function = 'by'.$type;

            try {
                $webdriver->$function($value);

                return true;
            } catch (\Exception $e) {
                return; // haven't found the element yet
            }
        }, $timeout);
    }
1100906
public function isElementVisible(string $locator, int $timeout = 5): bool
    {
        try {
            $element = $this->findElement($locator, $timeout);

            return isset($element) && $element->isVisible();
        } catch (ElementNotFoundException $e) {
            return false;
        }
    }