diff --git a/src/Browser.php b/src/Browser.php index 51f2420dd..656ce912e 100644 --- a/src/Browser.php +++ b/src/Browser.php @@ -635,6 +635,38 @@ public function pause($milliseconds) return $this; } + /** + * Pause for the given amount of milliseconds if the given condition is true. + * + * @param bool $boolean + * @param int $milliseconds + * @return $this + */ + public function pauseIf($boolean, $milliseconds) + { + if ($boolean) { + return $this->pause($milliseconds); + } + + return $this; + } + + /** + * Pause for the given amount of milliseconds unless the given condition is true. + * + * @param bool $boolean + * @param int $milliseconds + * @return $this + */ + public function pauseUnless($boolean, $milliseconds) + { + if (! $boolean) { + return $this->pause($milliseconds); + } + + return $this; + } + /** * Close the browser. *