1

I have a table scanned, in this table the last column for all the rows are links, I will put the general structure of the html down below. The thing is that when I am steering I can only access the column (tag td), but I can't get to the link (tag a) it self. If I use the action "X input" on the td tag it tells me the field doesn't have input defined and "{clicks}" also doesn't work because Tosca doesn't detect the element in the correct position in the browser. I also tried to scan a link (tag a) in the module definition and tried to put a dynamic xpath with a buffer that indicates the parent tag tr number that I need, but that doesn't work either. Does anyone know a workaround for this?

<table>

  <tr>

    <td>...</td>

    <td>...</td>

    ...
  
    ...

    <td><a../></td>

  </tr>

  <tr>

  ...

  ...
Andreina96
  • 11
  • 1
  • 2

1 Answers1

1

The trick is to perform your "X input" action on the TestStepValue for the Link element rather than the table cell itself. You can use table steering to navigate to the link element.

You'll first need to have a module attribute for a link element within the cell module attribute of the table you are steering. As long as the target cell contains only one link element, you won't need to worry about it being uniquely identifiable. In fact, any identifying attributes on that module attribute must be generic enough to match any link in the table that you might want to steer this way.

For example, if your table looks like this:

<table>
    <tr>
        <td>Some data</td>
        <td>Some more data</td>
        <td>
            <a>Link element in another cell</a>
        </td>
    </tr>
    <tr>
        <td>Some data</td>
        <td>Some more data<td>
        <td>
            <a>Link to be clicked</a>
        </td>
    </tr>
</table>

Your Module needs a Table module attribute with a structure similar to below:

Table
    Row
        Cell
            Link

You can either scan the link and drag & drop it into the cell module attribute. You can also add a link element to the cell by selecting the link icon from the context menu of the cell module attribute. This link to Tricentis documentation has a good visual: https://documentation.tricentis.com/en/1110/content/tbox/type_table.htm#Definingcontrolsincells

Then, assuming the target link is the third cell of row #2, our test step would navigate to the link in that cell, and perform the X input action on the link module attribute.

Name                    Value           Action Mode
Table                   {NULL}          Select
    $2 (Row)            {NULL}          Select
       $3 (Cell)        {NULL}          Select
            Link        X               Input

Basically, you'll step your way to the target link through a chain of 'Select' actions. Then, you can perform the input action on the isolated link element.