Why do I encounter the replay error "The specified item "#n" could not be found" in a data driven test case and how can I resolve it?
If after running a data driven test case the result file shows a replay error such as:
[ ] The specified item "#n" could not be found.
[ ] Occured in Select
[ ] Called from at
Go back to the script’s line in error:
[ ] TestApplication.ComboBox.TheComboBox.Select(rData.recSheet1_.Year)
From this data driven statement, the error is due to "n" being an INTEGER value from the source file that is being read in the ComboBox as the numerical index of an item. The returned error of the form ‘#n’ is the result of searching the "nth" item that does not actually exist on the list.
To resolve the script fail issue, manually add ‘Str’ in the Select statement of INTEGER value e.g.:
[ ] TestApplication.ComboBox.TheComboBox.Select(Str(rData.recSheet1_.Year))
This data driven statement will first convert "n" to a STRING value and will thus select the actual value (n) from the source list.