Retrieve a table row containing specified text from a given element.
\Behat\Mink\Element\Element $table: The table element.
string $search: The text to search for in the table row.
\Behat\Mink\Element\NodeElement The row element.
\Exception
protected function getTableRowWithText(Element $table, $search) {
$rows = $table
->findAll('css', 'tr');
if (empty($rows)) {
throw new \Exception(sprintf('No rows found on the received table element.'));
}
foreach ($rows as $row) {
if (strpos($row
->getText(), $search) !== FALSE) {
return $row;
}
}
throw new \Exception(sprintf('Failed to find a row containing "%s" on the received table.', $search));
}