/** * Waits for timeInMilliseconds ms or till the condition is satisfied on the browser, * which ever is sooner. * * @param integer $time time in milliseconds * @param string $condition JS condition */ public function wait($time, $condition) { $conditionResult = false; while ($time > 0 && 'true' !== $conditionResult) { usleep(100); $time -= 100; // don't throw exceptions try { $conditionResult = $this->con->evaluateJavascript($condition); } catch (\Exception $e) { $conditionResult = false; } } }
/** * Return true if the element is visible on the user interface. * * @return boolean */ public function isExists() { return 'true' === $this->con->evaluateJavascript(sprintf('_sahi._exists(%s)', $this->getAccessor())); }