【问题标题】:Watir iterating through a table to find a specific rowWatir 遍历表以查找特定行
【发布时间】:2016-06-13 18:19:57
【问题描述】:

我需要能够搜索此表并使用其标题找到特定行。 (我想找到我在下面的代码中显示的行):

<table class="no-btm-margin">
    <colgroup></colgroup>
    <thead></thead>
    <tbody>
        <tr></tr>
        <tr></tr>
        <tr>
            <td>
                <span class="vac-title">Test Vacancy 958075
            </td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td>
                <a href="/vacancy/review?vacancyReferenceNumber=525">Review vacancy</a>
            </td>
        </tr>
        <tr></tr>
        <tr></tr>

然后我需要跨行到最后一列并单击链接。有人可以给我一个可以做到这一点的方法的例子。

【问题讨论】:

  • 您是否正在寻找使用 Watir 或 Cheezy 的 Page-Object 的解决方案?虽然概念上相同,但它们将具有不同的语法。当你展示你的尝试时,人们也会喜欢它。

标签: ruby html-table watir rubymine pageobjects


【解决方案1】:

我使用以下方法修复了它:

table(:dashboard, :class => 'no-btm-margin')

上面的代码只允许使用关键字dashoard调用表格

dashboard_element['Test Vacancy 958075'][6].click

这对我有用,希望对你有用

【讨论】:

    猜你喜欢
    • 2017-08-21
    • 2020-08-21
    • 1970-01-01
    • 2014-11-22
    • 2017-05-26
    • 2012-07-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多