Skip to content

Commit 7b62097

Browse files
authored
add clickAndWaitForReload (#953)
1 parent 48ebc82 commit 7b62097

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/Concerns/WaitsForElements.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,19 @@ public function waitForReload($callback = null, $seconds = null)
318318
}, 'Waited %s seconds for page reload.');
319319
}
320320

321+
/**
322+
* Click an element and wait for the page to reload.
323+
*
324+
* @param string|null $selector
325+
* @return $this
326+
*/
327+
public function clickAndWaitForReload($selector = null)
328+
{
329+
return $this->waitForReload(function ($browser) use ($selector) {
330+
$browser->click($selector);
331+
});
332+
}
333+
321334
/**
322335
* Wait for the given callback to be true.
323336
*

0 commit comments

Comments
 (0)