Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475883
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:29+00:00 2026-05-25T06:45:29+00:00

I have a table on my page which is supposed to contain a certain

  • 0

I have a table on my page which is supposed to contain a certain element. I can identify the table by its name (it has a unique name), and I can also identify the element easily. I would like to assert that the element is present on row r, column c of the table. What is the cleanest way of doing it using Selenium commands?

Remarks:

  • I don’t want to use more than the table name in order to locate it (I don’t want all the div\div\table\div\tbody\td\tr[r]\td[c] in the code).
  • I’m using Selenium within PHPUnit. Hence, I can use PHP logic for the task, though I don’t want any complex logic for such a simple task.

Clarification:

If the element in the cell is just plain text, then I can retrieve that text like this:

$this->getText("xpath=//table[@name='tableName']//tr[".$r."]//td[".$c."]"); (PHP)

But what if the cell has an element which is not just plain 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 assert that an element specified by a locator of that element resides in a given cell.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:45:30+00:00Added an answer on May 25, 2026 at 6:45 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP page which will query records from a DB Table and
I have a table on near the bottom of the page, which I want
I have web page in PHP which displays all records in a table. I
In a particular page i have a ascx control which contains a table. Now
I have a table style page with rows. Each row has a checkbox. I
I have a table of pages in my database, each page can have a
I have a sql table images which has columns id , imagePath , caption``count
I have an html/css page that is supposed to use an html table layout
I have a web page that has an HTML table generated by an ASP.NET
I have an html table rendered page and I want to save it as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.