web table checkpoints
Up to this point I have been using TestComplete to test our desktop application. Now I am working on our Online/web based product. with the desktop testing there was a TableCheckpoint operation that i could drag and drop into the keyword test, select a cell and, voila, a check for all table cell values created. How do i accomplish the same thing for a table on a web page such as the one in the attached image?
Solved! Go to Solution.
I believe you'd use the same. If it is actually detected as a Table object, you can use the same checkpoint.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
I actually tried that before I created the post. the result was the "unable to retrieve table data for the checkpoint" error as shown in the attached image. I went through several TestComplete help screens such as "Parsing HTML Tables" and found some sample code that did parse through a very small table below the table I'm working on and I even found a link you provided in a post from 08-05-2011 about Web Table Checkpoints but I was unable to find the blog article referenced by the link (http://blog.smartbear.com/post/10-09-10/new-testcomplete-html-table-checkpoint-%e2%80%93-simplify-cr...). The table I'm dealing (from the image in my first post) is nested inside three <div> levels. The little table at the bottom that it did find was not inside any other tags. Not sure if that's help info or not but thought i'd throw it in there anyway.
Check how table is marked up on the page. If it is marked as a regular html table, then table checkpoint should work. The case is that majority of tables nowadays are emulated as a set of divs and other web elements that together look like the table on the rendered page but are loosely related one to another considering their html markup.
/Alex [Community Champion]
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
attached is an image showing how the tables are marked up. it's the table in the yellow highlighted box that I'm attempting to parse, however, I was not able to use the table checkpoint on either that one or on the table highlighted in blue at the bottom. both gave me the same error. I pasted the code shown below (copied from the "Parsing HTML Tables" topic in the TestComplete Help screeens) into my script and it diplayed the values of all three rows in that table in the log. However, not only would i need to have a solution that works for the yellow highlighted table, i would need it to record the existing values so that they can be checked during playback.
Note: before posting this i went back and double checked the HTML for the entire page. Even though the second table is at the same depth as the first <div> shown in the image, it too is nested within two more <div> tags and all are inside a <form> tag which is inside a <body> tag. So I believe it squarely fits within your description of the "tables nowadays are emulated as a set of divs and other web elements that together look like the table on the rendered page". So where does that leave me?
Dim page, table
Set page = Sys.Browser("*").Page("*")
Set table = page.FindChild("tagName", "table", 10)
If table.Exists Then
' Goes through the rows and cells of the table
For i = 0 To table.rows.length - 1
Log.AppendFolder("Row " & i)
For j = 0 To table.rows.item(i).cells.length - 1
Log.Message("Cell " & j & ": " & table.rows.item(i).cells.item(j).innerText)
Log.Warning("The table was not found")
I've never actually figured out a way to simply create a checkpoint for a web table so I've reached the conclusion that I must simply trudge through in record mode and select every individual table cell as a property checkpoint. Fortunately, so far, there's only been one or two really large tables. If I every find something simpler, I'll let you know but, for now, this is what i'm going with.