I have a table on my page that should contain a specific element. I can identify a table by its name (it has a unique name), and I can also easily identify an element. I would like to claim that the element is present in row r , column c table. What is the cleanest way to do this with Selenium commands?
Notes:
- I donβt want to use more than the table name to find it (I donβt want all
div\div\table\div\tbody\td\tr[r]\td[c] in the code). - I am using Selenium in PHPUnit. Therefore, I can use PHP logic for this task, although I do not need complex logic for such a simple task.
Clarification:
If the element in the cell is just text, then I can get this text as follows:
$this->getText("xpath=//table[@name='tableName']//tr[".$r."]//td[".$c."]"); (Php)
But what if a cell has an element that is not just text? What if the element is a link ( link=anchor ) or a button ( //button[@type='button'] ) or an image or something more complex?
I need to claim that the element indicated by the locator of this element is in this cell.
source share