- davidcory
- Posts : 4
Join date : 2012-11-01
Asserting data contained in a dynamically created table
Thu Nov 01, 2012 8:14 pm
Hi there,
I would like to assert data contained in a table. However, the data contained in the table is dynamically created and varies. Based on the generated HTML below, the logic I would like to do is
Select row where column 4 contains "Desc1"
For that row:
assert that column 7 contains "100.00"
assert that column 6 contains "No Match"
Select row where column 4 contains "Desc2"
For that row:
assert that column 7 contains "20.00"
assert that column 6 contains "Match"
I would like to assert data contained in a table. However, the data contained in the table is dynamically created and varies. Based on the generated HTML below, the logic I would like to do is
Select row where column 4 contains "Desc1"
For that row:
assert that column 7 contains "100.00"
assert that column 6 contains "No Match"
Select row where column 4 contains "Desc2"
For that row:
assert that column 7 contains "20.00"
assert that column 6 contains "Match"
- Code:
<tbody role="alert" aria-live="polite" aria-relevant="all">
<tr class="odd">
<td class=" sorting_1">197 </td>
<td class=" ">
<td class=" ">01 Nov 2012 </td>
<td class=" ">Desc1</td>
<td class=" ">100.00 </td>
<td class=" ">No Match </td>
<td class=" ">
</td>
</tr>
<tr class="even">
<td class=" sorting_1">198 </td>
<td class=" ">
<td class=" ">01 Nov 2012 </td>
<td class=" ">NigDesc2</td>
<td class=" ">20.00</td>
<td class=" ">Match</td>
<td class=" ">
</tr>
</tbody>
- ccoxMaster
- Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO
Re: Asserting data contained in a dynamically created table
Fri Nov 02, 2012 2:06 am
Just for clarification, are the number of rows in the table always the same? if not, it involves more logic. There are different ways to do this
So first I would start by checking if the first row in column 4 is present(if it is always present , you can ignore this). Next I would use storeTable to store the value in row1, column 4. Using gotoIf, you can evaluate if this value ==Desc1. if it does, send the flow to a label where it can store then assert the other values. If it does not, check to see if another row exists. If it does exist store the value in row2, column 4. Evaluate if this ==Desc1, if this matches, store and assert the values you would like and then repeat the initial process for Desc2.
Let me know if this doesn't make sense. There is another way to do this, but the way I have explained logically makes sense(at least to me )
So first I would start by checking if the first row in column 4 is present(if it is always present , you can ignore this). Next I would use storeTable to store the value in row1, column 4. Using gotoIf, you can evaluate if this value ==Desc1. if it does, send the flow to a label where it can store then assert the other values. If it does not, check to see if another row exists. If it does exist store the value in row2, column 4. Evaluate if this ==Desc1, if this matches, store and assert the values you would like and then repeat the initial process for Desc2.
Let me know if this doesn't make sense. There is another way to do this, but the way I have explained logically makes sense(at least to me )
- davidcory
- Posts : 4
Join date : 2012-11-01
Re: Asserting data contained in a dynamically created table
Mon Nov 05, 2012 5:47 pm
Hi there,
Yes this is a dynamic table, i.e. the number of rows will vary each time I want to assert, certainly your thoughts on looping round each row of the table make sense.
I'll give that a go but make have to come back with information on how to do my looping
Yes this is a dynamic table, i.e. the number of rows will vary each time I want to assert, certainly your thoughts on looping round each row of the table make sense.
I'll give that a go but make have to come back with information on how to do my looping
- ccoxMaster
- Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO
Re: Asserting data contained in a dynamically created table
Thu Nov 08, 2012 1:14 am
I did a little more research on other ways to do this. There is a storeXPathCount command that is able to store the number of rows in a specific table. By using this, you don't have to check each time if there is another row, since you now know how many there are.
Hopefully this helps
Hopefully this helps
Permissions in this forum:
You cannot reply to topics in this forum