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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:03:21+00:00 2026-05-23T13:03:21+00:00

I am using watir-webdriver to scrape from a page with nested table based layout.

  • 0

I am using watir-webdriver to scrape from a page with nested table based layout. As an example, I constructed a very small toy site at http://veryslow.staticloud.com/. To search for the innermost table, that contains the elements USSR and Brazil, I use the following code:

require "rubygems"
require "watir-webdriver"
r = Watir::Browser.new
br.goto("http://veryslow.staticloud.com/")
reg = /USSR.+Brazil/m
mytable = br.table(:text,reg).table(:text,reg).table(:text,reg).table(:text,reg).table(:text, reg).table(:text, reg)
mytable.text

I have two questions:

  1. Is there a better way to search for these inner tables?
  2. Why is it so slow? To actually locate the table (done when I call mytable.text), it takes a substantial amount of time. For complex websites with nested table based layout, this is painfully long.

I know the nested table design is a bad idea, but if you have to read from them, is there a faster way to do that?

  • 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-23T13:03:22+00:00Added an answer on May 23, 2026 at 1:03 pm

    Whenever you’re using a Regexp to locate elements, we need to do the filtering on the Ruby side as opposed to in the browser itself. That means that for each time you call .table(:text, reg) here, we find all the tables inside the containing element, and filter through that in Ruby to find one that matches the Regexp. That’s going to be slow, especially with a page like this.

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

Sidebar

Related Questions

I'm new on Watir-webdriver. I have tried running watir-webdriver using Firefox on http://bit.ly/watir-example I
I am using watir-webdriver and am attempting to check the background-color of an HTML
I would like to set a text field with watir-webdriver using css selectors to
Using Rubygems and Watir I'm unable to select options from a second drop down.
So I'm using Watir WebDriver with both Firefox and Chrome. Chrome is much faster
I'm using Watir-webdriver and I was wondering if there was a good way to
How can you send control key combination to an element when using watir-webdriver? Currently
I'm evaluating Watir-webdriver, to decide if i can switch to using it for my
I have a script running watir-webdriver(using Firefox 4.0) that needs to access a web
I am writing automation scripts using WATIR and WATIN. Watir has something called page

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.