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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:43:06+00:00 2026-05-28T06:43:06+00:00

On a dynamic web page I don’t know the number of matching elements upfront,

  • 0

On a dynamic web page I don’t know the number of matching elements upfront, so I won’t know which index # to use.

Does watir-webdriver provide a way to access the LAST matching element, not first as by default?

The HTML in question forms a calendar control

<table border="0" class="body-style">
  <tbody>
    <tr>
      <td width="27" align="right"><b>Sun</b></td>
      <td width="27" align="right"><b>Mon</b></td>
      <td width="27" align="right"><b>Tue</b></td>
      <td width="27" align="right"><b>Wed</b></td>
      <td width="27" align="right"><b>Thu</b></td>
      <td width="27" align="right"><b>Fri</b></td>
      <td width="27" align="right"><b>Sat</b></td></tr>
    <tr>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;1Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;2Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;3Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;4Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;5Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;6Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;7Â&nbsp;</p></td></tr>
    <tr>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;8Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;9Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;10Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;11Â&nbsp;</p></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;12Â&nbsp;</p></td>
      <td align="right"><a class="current-day-style selected-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=13;closeCalendar();doOtherFunctions();">Â&nbsp;13Â&nbsp;</a></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;14Â&nbsp;</p></td></tr>
    <tr>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;15Â&nbsp;</p></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=16;closeCalendar();doOtherFunctions();">Â&nbsp;16Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=17;closeCalendar();doOtherFunctions();">Â&nbsp;17Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=18;closeCalendar();doOtherFunctions();">Â&nbsp;18Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=19;closeCalendar();doOtherFunctions();">Â&nbsp;19Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=20;closeCalendar();doOtherFunctions();">Â&nbsp;20Â&nbsp;</a></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;21Â&nbsp;</p></td></tr>
    <tr>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;22Â&nbsp;</p></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=23;closeCalendar();doOtherFunctions();">Â&nbsp;23Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=24;closeCalendar();doOtherFunctions();">Â&nbsp;24Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=25;closeCalendar();doOtherFunctions();">Â&nbsp;25Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=26;closeCalendar();doOtherFunctions();">Â&nbsp;26Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=27;closeCalendar();doOtherFunctions();">Â&nbsp;27Â&nbsp;</a></td>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;28Â&nbsp;</p></td></tr>
    <tr>
      <td align="right"><p class="end-of-weekday-style">Â&nbsp;29Â&nbsp;</p></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=30;closeCalendar();doOtherFunctions();">Â&nbsp;30Â&nbsp;</a></td>
      <td align="right"><a class="normal-day-style" onmousemove="window.status=&quot; &quot;" onmouseout="window.status=&quot; &quot;" title="" href="javascript:dateSelected=31;closeCalendar();doOtherFunctions();">Â&nbsp;31Â&nbsp;</a></td></tr>
  </tbody>
</table>
  • 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-28T06:43:07+00:00Added an answer on May 28, 2026 at 6:43 am

    Try this (example assumes you are looking for div elements)

    browser.divs(:how => 'what').last
    

    The plural for most elements will return a collection of matching elements (e.g. add s or es to the element/tag name as would be appropriate. div -> divs, address -> addresses) And Ruby, great language that it is has a fast way to get the last element in collection via the .last method.

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

Sidebar

Related Questions

I have a web page that displays dynamic data which changes every 2 seconds.
I have dynamic web page with JS. There is a <textarea> and a Send
I'm working on a PHP dynamic web page that has a <textarea> element that
I'd like to extract all the ISBNs on a dynamic web page that I
I'm developing a dynamic data web app. On list.aspx page it has GridViewPager control
I use PHP to generate dynamic Web pages. As stated on the following tutorial
I'm designing a dynamic web page that loads contents by AJAX, like the wall
I'm developing a web page for a customer using the Silverlight application for dynamic
I am trying to add some basic dynamic functionality to a web page. How
I'm trying to write a fairly complex dynamic web page, using JQuery AJAX, and

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.