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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:09:58+00:00 2026-06-04T19:09:58+00:00

I’m a new comer to both Ruby (Watir) and Javascript. If an website uses

  • 0

I’m a new comer to both Ruby (Watir) and Javascript. If an website uses Javascript code that dynamically (by clicking button or such) generates buttons, I have no idea how to access to them. It may have its own name or id, but I even can’t check it, since the generated buttons aren’t founded on the source code of a web page via browser…

I thought it could be an answer;

browser = Watir::Browser.new(:firefox)
browser.send_keys :tab

until I realized I seem not to have a way to refer to the focused button, even if I set the focus on the target by tab key…

EDIT: Thanks guys. I think it was a noob question now I just face another big problem (all the generated buttons share the exactly same attributes!!, so I can’t specify which), but that’s another story…

**EDIT2: I just solved my second question.

browser.button(:attribute => "same", :index => *).click

this!

Noob Question

2012.5 – 2012.5

  • 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-04T19:09:59+00:00Added an answer on June 4, 2026 at 7:09 pm

    Firefox has a tool for inspecting elements. You should be able to right-click an element and select the ‘Inspect Element’ menu option. Then push the HTML button to view the source for that button.

    Once you see the source, you should be able to determine its attributes to click the button like any other button (assuming the button is already made visible).

    So you would have a script like:

    browser = Watir::Browser.new(:firefox)
    browser.goto('http://my.page')
    #Click the button that generates the other buttons
    browser.button(:id, 'generate_buttons_button').click 
    #Click the newly displayed buttons once they appear
    generated_button = browser.button(:id, 'generated_button')
    generated_button.wait_until_present
    generated_button.click
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a

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.