Rational Functional Tester, how to dynamically identify links in an HTML table?












0















I have HTML that looks something like this:



<table summary="History of xxxxxx"><thead><tr><th>Date Started</th><th>Date Updated</th><th>Yyyyyyyy</th><th>Summary Report</th>  
<th>Full Report</th></tr></thead><tbody><tr class="odd"><td>05/29/2012</td><td>05/29/2012</td>
<td><a href="/xxxxx/yyyyy/traversal/e3230f12-dea6-4fd9-b4ed-dd60deb65aa3">Complete </a>
<a href="/xxxxx/yyyyy/delete">Delete</a></td><td/><td/></tr><tr class="even"><td>05/29/2012</td>
<td>05/29/2012</td><td/><td><a href="/xxxxx/summaryreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
<a href="/xxxxx/summaryreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
<a href="/xxxxx/summaryreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td><td>
<a href="/xxxxx/fullreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
<a href="/xxxxx/fullreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
<a href="/xxxxx/fullreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td></tr></tbody></table>


I can print the content of the table using the following script fragment:



ITestDataTable kontents = (ITestDataTable) table_dateStartedDateUpdatedAs().getTestData("contentswithchildren");

System.out.println (table_dateStartedDateUpdatedAs().getTestDataTypes());

System.out.println ("Total Rows in table : " + kontents.getRowCount());
System.out.println ("Total Cols in table : " + kontents.getColumnCount());

for (int row=0; row < kontents.getRowCount();++row)
{
for (int col=0; col < kontents.getColumnCount();++col)
{
System.out.println("contents("+row+","+col+")=""+kontents.getCell(row,col)+""");
}
}


But how can I get the hyperlinks into their own variables? The three hyperlinks, View Save Print, are all in one cell.



--Thank you,



--Mike Jr.










share|improve this question





























    0















    I have HTML that looks something like this:



    <table summary="History of xxxxxx"><thead><tr><th>Date Started</th><th>Date Updated</th><th>Yyyyyyyy</th><th>Summary Report</th>  
    <th>Full Report</th></tr></thead><tbody><tr class="odd"><td>05/29/2012</td><td>05/29/2012</td>
    <td><a href="/xxxxx/yyyyy/traversal/e3230f12-dea6-4fd9-b4ed-dd60deb65aa3">Complete </a>
    <a href="/xxxxx/yyyyy/delete">Delete</a></td><td/><td/></tr><tr class="even"><td>05/29/2012</td>
    <td>05/29/2012</td><td/><td><a href="/xxxxx/summaryreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
    <a href="/xxxxx/summaryreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
    <a href="/xxxxx/summaryreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td><td>
    <a href="/xxxxx/fullreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
    <a href="/xxxxx/fullreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
    <a href="/xxxxx/fullreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td></tr></tbody></table>


    I can print the content of the table using the following script fragment:



    ITestDataTable kontents = (ITestDataTable) table_dateStartedDateUpdatedAs().getTestData("contentswithchildren");

    System.out.println (table_dateStartedDateUpdatedAs().getTestDataTypes());

    System.out.println ("Total Rows in table : " + kontents.getRowCount());
    System.out.println ("Total Cols in table : " + kontents.getColumnCount());

    for (int row=0; row < kontents.getRowCount();++row)
    {
    for (int col=0; col < kontents.getColumnCount();++col)
    {
    System.out.println("contents("+row+","+col+")=""+kontents.getCell(row,col)+""");
    }
    }


    But how can I get the hyperlinks into their own variables? The three hyperlinks, View Save Print, are all in one cell.



    --Thank you,



    --Mike Jr.










    share|improve this question



























      0












      0








      0








      I have HTML that looks something like this:



      <table summary="History of xxxxxx"><thead><tr><th>Date Started</th><th>Date Updated</th><th>Yyyyyyyy</th><th>Summary Report</th>  
      <th>Full Report</th></tr></thead><tbody><tr class="odd"><td>05/29/2012</td><td>05/29/2012</td>
      <td><a href="/xxxxx/yyyyy/traversal/e3230f12-dea6-4fd9-b4ed-dd60deb65aa3">Complete </a>
      <a href="/xxxxx/yyyyy/delete">Delete</a></td><td/><td/></tr><tr class="even"><td>05/29/2012</td>
      <td>05/29/2012</td><td/><td><a href="/xxxxx/summaryreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
      <a href="/xxxxx/summaryreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
      <a href="/xxxxx/summaryreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td><td>
      <a href="/xxxxx/fullreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
      <a href="/xxxxx/fullreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
      <a href="/xxxxx/fullreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td></tr></tbody></table>


      I can print the content of the table using the following script fragment:



      ITestDataTable kontents = (ITestDataTable) table_dateStartedDateUpdatedAs().getTestData("contentswithchildren");

      System.out.println (table_dateStartedDateUpdatedAs().getTestDataTypes());

      System.out.println ("Total Rows in table : " + kontents.getRowCount());
      System.out.println ("Total Cols in table : " + kontents.getColumnCount());

      for (int row=0; row < kontents.getRowCount();++row)
      {
      for (int col=0; col < kontents.getColumnCount();++col)
      {
      System.out.println("contents("+row+","+col+")=""+kontents.getCell(row,col)+""");
      }
      }


      But how can I get the hyperlinks into their own variables? The three hyperlinks, View Save Print, are all in one cell.



      --Thank you,



      --Mike Jr.










      share|improve this question
















      I have HTML that looks something like this:



      <table summary="History of xxxxxx"><thead><tr><th>Date Started</th><th>Date Updated</th><th>Yyyyyyyy</th><th>Summary Report</th>  
      <th>Full Report</th></tr></thead><tbody><tr class="odd"><td>05/29/2012</td><td>05/29/2012</td>
      <td><a href="/xxxxx/yyyyy/traversal/e3230f12-dea6-4fd9-b4ed-dd60deb65aa3">Complete </a>
      <a href="/xxxxx/yyyyy/delete">Delete</a></td><td/><td/></tr><tr class="even"><td>05/29/2012</td>
      <td>05/29/2012</td><td/><td><a href="/xxxxx/summaryreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
      <a href="/xxxxx/summaryreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
      <a href="/xxxxx/summaryreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td><td>
      <a href="/xxxxx/fullreport/view/280e30fe-f7dc-4099-b83e-28e02d64f68f">View</a>
      <a href="/xxxxx/fullreport/save/280e30fe-f7dc-4099-b83e-28e02d64f68f">Save</a>
      <a href="/xxxxx/fullreport/print/280e30fe-f7dc-4099-b83e-28e02d64f68f">Print</a></td></tr></tbody></table>


      I can print the content of the table using the following script fragment:



      ITestDataTable kontents = (ITestDataTable) table_dateStartedDateUpdatedAs().getTestData("contentswithchildren");

      System.out.println (table_dateStartedDateUpdatedAs().getTestDataTypes());

      System.out.println ("Total Rows in table : " + kontents.getRowCount());
      System.out.println ("Total Cols in table : " + kontents.getColumnCount());

      for (int row=0; row < kontents.getRowCount();++row)
      {
      for (int col=0; col < kontents.getColumnCount();++col)
      {
      System.out.println("contents("+row+","+col+")=""+kontents.getCell(row,col)+""");
      }
      }


      But how can I get the hyperlinks into their own variables? The three hyperlinks, View Save Print, are all in one cell.



      --Thank you,



      --Mike Jr.







      rft






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 14:25









      Sneftel

      23.9k64278




      23.9k64278










      asked May 29 '12 at 22:09









      Mike JrMike Jr

      7943819




      7943819
























          1 Answer
          1






          active

          oldest

          votes


















          2














          Use the find() function.



          Take a look at the searching for test objects article in the online RFT help.



          Sample code for your table would look something like the following:



          TestObject foundSaveLinks = table_dateStartedDateUpdatedAs().find(atDescendant(".tag", "A", ".text", "Save"));
          GuiTestObject saveLink = (GuiTestObject)foundSaveLinks[0];
          saveLink.Click();


          You can make this more complex, for example if you need to limit the search/find to a specific table cell. My sample above will find all of the "Save" links that are descendants of the table.






          share|improve this answer
























          • Tom, thank you. After reading your comment I found the relevant section in the Chip Davis, et al book.

            – Mike Jr
            Jun 11 '12 at 22:28











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10807417%2frational-functional-tester-how-to-dynamically-identify-links-in-an-html-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          Use the find() function.



          Take a look at the searching for test objects article in the online RFT help.



          Sample code for your table would look something like the following:



          TestObject foundSaveLinks = table_dateStartedDateUpdatedAs().find(atDescendant(".tag", "A", ".text", "Save"));
          GuiTestObject saveLink = (GuiTestObject)foundSaveLinks[0];
          saveLink.Click();


          You can make this more complex, for example if you need to limit the search/find to a specific table cell. My sample above will find all of the "Save" links that are descendants of the table.






          share|improve this answer
























          • Tom, thank you. After reading your comment I found the relevant section in the Chip Davis, et al book.

            – Mike Jr
            Jun 11 '12 at 22:28
















          2














          Use the find() function.



          Take a look at the searching for test objects article in the online RFT help.



          Sample code for your table would look something like the following:



          TestObject foundSaveLinks = table_dateStartedDateUpdatedAs().find(atDescendant(".tag", "A", ".text", "Save"));
          GuiTestObject saveLink = (GuiTestObject)foundSaveLinks[0];
          saveLink.Click();


          You can make this more complex, for example if you need to limit the search/find to a specific table cell. My sample above will find all of the "Save" links that are descendants of the table.






          share|improve this answer
























          • Tom, thank you. After reading your comment I found the relevant section in the Chip Davis, et al book.

            – Mike Jr
            Jun 11 '12 at 22:28














          2












          2








          2







          Use the find() function.



          Take a look at the searching for test objects article in the online RFT help.



          Sample code for your table would look something like the following:



          TestObject foundSaveLinks = table_dateStartedDateUpdatedAs().find(atDescendant(".tag", "A", ".text", "Save"));
          GuiTestObject saveLink = (GuiTestObject)foundSaveLinks[0];
          saveLink.Click();


          You can make this more complex, for example if you need to limit the search/find to a specific table cell. My sample above will find all of the "Save" links that are descendants of the table.






          share|improve this answer













          Use the find() function.



          Take a look at the searching for test objects article in the online RFT help.



          Sample code for your table would look something like the following:



          TestObject foundSaveLinks = table_dateStartedDateUpdatedAs().find(atDescendant(".tag", "A", ".text", "Save"));
          GuiTestObject saveLink = (GuiTestObject)foundSaveLinks[0];
          saveLink.Click();


          You can make this more complex, for example if you need to limit the search/find to a specific table cell. My sample above will find all of the "Save" links that are descendants of the table.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jun 7 '12 at 14:56









          Tom ETom E

          2,42421421




          2,42421421













          • Tom, thank you. After reading your comment I found the relevant section in the Chip Davis, et al book.

            – Mike Jr
            Jun 11 '12 at 22:28



















          • Tom, thank you. After reading your comment I found the relevant section in the Chip Davis, et al book.

            – Mike Jr
            Jun 11 '12 at 22:28

















          Tom, thank you. After reading your comment I found the relevant section in the Chip Davis, et al book.

          – Mike Jr
          Jun 11 '12 at 22:28





          Tom, thank you. After reading your comment I found the relevant section in the Chip Davis, et al book.

          – Mike Jr
          Jun 11 '12 at 22:28


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10807417%2frational-functional-tester-how-to-dynamically-identify-links-in-an-html-table%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Create new schema in PostgreSQL using DBeaver

          Deepest pit of an array with Javascript: test on Codility

          Costa Masnaga