English 中文(简体)
Watir-webdriver如何进入LAST配对装置,不是首先?
原标题:Watir-webdriver how to access LAST matching element not first?

在充满活力的网页上,我不知道对应因素的数量,因此,我掌握了哪些指数。

watir-webdriver是否为接触LAST配对器提供了一种途径,而并非先是默认?

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>
最佳回答

引证(例假设你正在寻找零件)

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.

问题回答

岗位。

所涉的超文本是:

<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>





相关问题
Ruby parser in Java

The project I m doing is written in Java and parsers source code files. (Java src up to now). Now I d like to enable parsing Ruby code as well. Therefore I am looking for a parser in Java that parses ...

rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

multiple ruby extension modules under one directory

Can sources for discrete ruby extension modules live in the same directory, controlled by the same extconf.rb script? Background: I ve a project with two extension modules, foo.so and bar.so which ...

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

热门标签