Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
davidcory
Posts : 4
Join date : 2012-11-01

Asserting data contained in a dynamically created table Empty 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"



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>
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

Asserting data contained in a dynamically created table Empty 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 Smile )
avatar
davidcory
Posts : 4
Join date : 2012-11-01

Asserting data contained in a dynamically created table Empty 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 Smile
avatar
ccox
Master
Master
Posts : 205
Join date : 2012-01-06
Age : 39
Location : Denver, CO

Asserting data contained in a dynamically created table Empty 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
Sponsored content

Asserting data contained in a dynamically created table Empty Re: Asserting data contained in a dynamically created table

Back to top
Permissions in this forum:
You cannot reply to topics in this forum