Skip to content

Commit

Permalink
added waitForTextIn Function (#823)
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiReichart authored Oct 1, 2020
1 parent 4985279 commit 818a872
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Concerns/WaitsForElements.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,25 @@ public function waitForText($text, $seconds = null)
}, $message);
}

/**
* Wait for the given text to be visible inside the given selector.
*
* @param string $selector
* @param array|string $text
* @param int $seconds
* @return $this
*
* @throws \Facebook\WebDriver\Exception\TimeOutException
*/
public function waitForTextIn($selector, $text, $seconds = null)
{
$message = 'Waited %s seconds for text "'.$text.'" in selector '.$selector;

return $this->waitUsing($seconds, 100, function () use ($selector, $text) {
return $this->assertSeeIn($selector, $text);
}, $message);
}

/**
* Wait for the given link to be visible.
*
Expand Down

0 comments on commit 818a872

Please sign in to comment.