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 8565299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:23:41+00:00 2026-06-11T17:23:41+00:00

EDIT: I also tried this var webElements1 = (Driver.FindElements(By.XPath(//*[@id=’ctl00_ContentPlaceHolder1_Control1_lstCategory’]//input))).ToList(); I get the empty Text

  • 0

EDIT:
I also tried this

 var webElements1 = (Driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_Control1_lstCategory']//input"))).ToList();

I get the empty Text

I am trying to find a way to grab just ID from the list i am getting and below is my code and a print shot of my screen.

//WebDriver getting a list of Text

the below code returns me the correct number of records but it just give me the Text but I am after Text and Id of an particular Text

I tried this:

var webElements1 = (Driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_Control1_lstCategory']/tbody/tr/td/span"))).ToList();

this

var webElements2 = (Driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_Control1_lstCategory']/tbody/tr/td"))).ToList();

and this…

var webElements3 = (Driver.FindElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_Control1_lstCategory']"))).ToList();

the all code of line gives me the correct returns but without Id.

Here is the print screen of my page:

enter image description here

  • 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-06-11T17:23:43+00:00Added an answer on June 11, 2026 at 5:23 pm

    After getting all the elements using below method, run in loop to get all element’s ids:

    List<WebElement> element = driver.findElements(By.XPath("//*[@id='ctl00_ContentPlaceHolder1_Control1_lstCategory']//input")));
    
    for(WebElement ele:elements)
    {
    
            ele.getAttribute("id");     // for getting id of each element
    
            ele.getText();              //for getting text of each element
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: There's now a doc page on this so this question is irrelevant, also
Is it possible to pass the coloumn name also like a variable.Please edit this
i know this sounds simple for some people out there. i also tried this
I want to copy my NSDictionary's data into plist and also edit some data
LATER EDIT: Please mention not only game programming books, but also more scientific/simulation oriented
EDIT 07/14 As Bill Burgess mentionned in a comment of his answer, this question
I am trying to get this result: You can type a number in a
This is my function: class function TCelebrity.ReadArray<T>(length:integer): byte; var b:pointer; begin b := @Result;
I want to create a Comparison<>-Delegate via reflection in code. I have this: var
EDIT: to cut this short: is there a way to call $kernel->getRootDir(); from within

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.