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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:56:14+00:00 2026-06-04T08:56:14+00:00

I am using Selenium 2.0, Firefox 11.0, and Java to process a table. I

  • 0

I am using Selenium 2.0, Firefox 11.0, and Java to process a table. I have a table element composed of td cells, some which contain text included in a span element, others which contain input elements which have text in their value attributes. My goal is to get the text of every cell so I can output the table contents and compare them against expected values. I thought I would just do something like this:

Locate the table WebElement by id
List<WebElement> cells = tableElem.findElements(By.xpath(".//td"));

Then I would loop through all the cells and run findElements with the xpath “.//input” and if the list was empty I would run getText on the webElement, and if the list wasn’t empty I would run getAttribute on the input element.

But to my surprise, this took several minutes to run on firefox (I’m afraid to try it on IE, which is where its supposed to be tested). When I debug it is obvious that the bottleneck is the .//input search from the td which is killing me. It is upwards of ten seconds, and so even with just a few cells my tests are taking forever. I’ve tried all sorts of minor variations to the xpath, tried going to css selectors, and continue to get the same results.

I want some advice about how to either tackle this problem differently or how to optimize my current method. I was hoping this would only take a couple of seconds.

I’ve included some sample code that should illustrate the slowdown I’m experiencing. This is not the website I’m screen scraping, but the slowness is the same:

    webDriver.navigate().to("https://accounts.google.com/NewAccount");
    List<WebElement> TDxpath = webDriver.findElements(By.xpath("//td"));
    List<WebElement> TDcss = webDriver.findElements(By.cssSelector("td"));
    for (WebElement td : TDcss) {
        List<WebElement> q = td.findElements(By.cssSelector("input"));
    }
    for (WebElement td : TDxpath) {
        List<WebElement> r = td.findElements(By.xpath(".//input"));
    }
  • 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-04T08:56:16+00:00Added an answer on June 4, 2026 at 8:56 am

    Do you really need a browser? You could try HtmlUnitDriver, that will be blazingly fast!

    Or you could do it as a JS, that also only takes a fraction of time and you can get Lists from the script:

    (JavascriptExecutor)driver.executeScript(
        "var tds = document.getElementsByTagName('td');"
        "for (var i = 0; i < tds.length; i++) {" +
        "   var inputs = tds[i].getElementsByTagName('input');" +
        "}"
        );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Selenium IDE Firefox plugin to create some test cases. I click
I'm using Selenium IDE 1.7.2 and Firefox 10.0.2 In the page which I'm writing
I'm using Selenium for work and I have extract some data from //ul, unfortunately
i'm use selenium. i use it by using firefox plugin. but i have problem
I'm using Selenium Java 2.0b3 . I have this code: ... WebDriver driver =
I have a suite of Selenium tests (created using Java in Selenium RC 1.0.3)
Is there anyone know how to read FireFox Browser Status bar text using Selenium
I have started using the selenium plugin for firefox for web automated testing. Is
We are running some tests using selenium. We have dedicated Windows XP VM's for
I'm using selenium webdriver to do some downloading using firefox. At the moment my

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.