diff --git a/src/Concerns/WaitsForElements.php b/src/Concerns/WaitsForElements.php index 3b5a7b959..cf0d2c34b 100644 --- a/src/Concerns/WaitsForElements.php +++ b/src/Concerns/WaitsForElements.php @@ -318,6 +318,19 @@ public function waitForReload($callback = null, $seconds = null) }, 'Waited %s seconds for page reload.'); } + /** + * Click an element and wait for the page to reload. + * + * @param string|null $selector + * @return $this + */ + public function clickAndWaitForReload($selector = null) + { + return $this->waitForReload(function ($browser) use ($selector) { + $browser->click($selector); + }); + } + /** * Wait for the given callback to be true. *