【问题标题】:Selenium IDE how to verify the text of the tooltip in a tableSelenium IDE如何验证表格中工具提示的文本
【发布时间】:2014-07-10 16:48:03
【问题描述】:

您好,我有一个要在 selenium IDE 中测试的场景,表中特定元素的“工具提示”文本是否正确?这不是表中唯一的工具提示。我在http://seleniumatmindfire.blogspot.co.uk/2012/06/verify-tool-tip-text-in-selenium.html#comment-form 中找到了某种答案 但我无法从工具提示的 title="add note" 中获取文本。附件是一个屏幕打印,显示“工具提示”弹出为“添加注释”,这是不正确的(已提出问题)。我对这种类型的测试很陌生,并且在遇到困难时找到了答案,但我正在努力获得正确的存储命令和目标 - 我得到的最接近的是

<tr>
    <td>storeElementPresent</td>
    <td>.//*[@id='opportunities-table']/tbody/tr[1]/td[5]/a@title</td>
    <td>tooltip</td>
</tr>
<tr>
    <td>echo</td>
    <td>${tooltip}</td>
    <td></td>
</tr>

echo 打印为 'false' - 我需要它来打印工具提示标题以进行比较和验证。

代码副本:

<div class="container-fluid" style="background-color: transparent;">
<div id="portal_service_dialog" class="jqmWindow jqmID1">
<div id="csi_dialog" class="jqmWindowCSI jqmID2">
<script type="text/javascript">         jQuery(function() {             // initialising a Widget object starts .live listening for dialog_link clicks             var $Widget = new Widgets({  });         }) ;         </script>
<div id="subMenuSection">
<div class="pageContent">
<div id="csi_opportunities" class="row-fluid">
<div>
<div style="height: 25px;">
<div id="edit-custom-table-view-container" class="hide"/>
<div id="search_results" style="">
<div id="opportunities-table_wrapper" class="dataTables_wrapper">
<div class="dataTables_table_paging_div">
<table id="opportunities-table" class="table table-condensed dataTable" style="">
<thead>
<tbody>
<tr class="cs_details_value">
<td class=""/>
<td>
<td/>
<td class=""/>
<td class=" sorting_1">
<a class="external_link" target="_blank" title="add note"![enter image description here][1] href="/cgi-bin/index.cgi/CustomerService/Opportunities/view/e62f3cb8-791a-4ae4-1c5e-5388b0dd72a1" style="background-color: transparent;">3</a>
</td>
<td>
<td class="text align right">100</td>
<td class="text align right">0</td>
<td>
<td>New</td>
<td class="text align right">50%</td>
<td/>
<td>
<td>
<td>
</tr>
<tr class="cs_details_value">
<tr class="cs_details_value">
<tr class="cs_details_value">
<tr class="cs_details_value">
<tr class="cs_details_value">
<tr class="cs_details_value">
</tbody>
</table>
<div class="bottom_pagination">
</div>
</div>
</div>

在此先感谢,因为我确信有简单的方法可以做到这一点,如果需要任何其他信息,请告诉我。 杰夫

【问题讨论】:

    标签: tooltip selenium-ide


    【解决方案1】:

    我认为您应该尝试使用storeAttribute 而不是storeElementPresent 作为origin references

    【讨论】:

      【解决方案2】:

      我需要感谢@Hai Lu...经过更多思考后,我尝试使用 CSS 定位器添加 @title 并使用 storeAttribute echo 现在生成工具提示的“标题”:

      <tr>
          <td>storeAttribute</td>
          <td>css=td..sorting_1 &gt; a.external_link@title</td>
          <td>tooltip</td>
      </tr>
      <tr>
          <td>echo</td>
          <td>${tooltip}</td>
          <td></td>
      </tr>
      

      [信息] 执行:|echo | ${工具提示} | [信息] 回声:添加注释 我现在可以比较和验证。 再次感谢

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-06-11
        • 1970-01-01
        • 2021-02-04
        • 2018-01-17
        • 2013-07-15
        • 1970-01-01
        • 2011-01-08
        • 1970-01-01
        相关资源
        最近更新 更多