I am starting to use Behat/Mink with the Selenium2 driver and I wondered if it was possible to get the value from a particular cell of a HTML table that might be on my page. The td tags do not have anything to identify them. But I used to use actiwate unit tests and they used to have a function that allowed me to get a cell based on its position. Does anything like that exist?.
I would even take an answer that gave me an entire row at this stage!
Thanks.
You can use something like this.
/**
* @Given /^The cell contains "([^"]*)"$/
*/
public function cellContains($value)
{
$td = $this->getSession()->getPage()->find('css',
sprintf('table tbody tr td:contains("%s")', $value)
);
// rest of your code
}
If you could provide an example of the table maybe I can give you a more accurate code.