Selenium: How do I assert that a certain element is present in a certain cell of a certain table?
You could try Selenium's getXpathCount
$this->("xpath=//table[@name='tableName']//tr[".$r."]//td[".$c."]//TAG");
This will return the number of matches the xpath gets. in your case, zero would mean a fail.
Sounds like you want isElementPresent(...locator of element...)
. For example:
$cell = "//table[@name='tableName']//tr[".$r."]/td[".$c."]";$foundLink = $this->isElementPresent("xpath=".$cell."/a[.='".linktext."']");$foundButton = $this->isElementPresent("xpath=".$cell."/button[@type='button']");$foundImage = $this->isElementPresent("xpath=".$cell."/img[ends-with(@src='pretty-pony.gif')]");
isElementPresent()
returns true
if so, false
if not.