In an application you have a web table. You are provided
with an external Excel sheet with the same structure as that
of the web table.
How will you retrieve all data from the web table and
compare it with corresponding data available in the excel
sheet, using QTP?
How will you report the results in QTP?

Answer Posted / saket bharti

'Get the Web Table Row and Col count using the GetROProperty

rowcount=
Browser("").Page("").WebTable("").GetRoProperty("rows")

colcount=
Browser("").Page("").WebTable("").GetRoProperty("cols")

'Create a Excel COM object to read the data from the file.
Set excelobj=CreateObject("Excel.Application")
Set excelbooks=excelobj.Workbooks.open("C:\Data-excel.xls")
Set excelsheets=excelobj.Worksheets.item("Sheet1")

'Now loop through the excel and the wettable and check their
values

for i=0 to rowcount
for j=0 to colcount

if (
Browser("").Page("").WebTable("").GetCellData(i,j)=excelsheets.Cells(i,j))
Then

Reporter.ReportEvent micPass ,"Validation","Cell values & i
& j are same"

Else

Reporter.ReportEvent micFail ,"Validation","Cell values & i
& j do not match"

End If

Next
Next

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

you are recording on "WINDOW 1", say it has a link if you click on that, that leads you to "WINDOW 2". If you do any manipulations on "WINDOW 2" that are automatically updated in to "WINDOW 1". But "WINDOW 1" is currently invisible. But the updations in "WINDOW 1" must also be recorded as a script in QTP. The best Example is if you update your resume in JOB STREET portal it actually happens in other window, but the previous window is automatically updated. Now does QTP help you in this types of situations? Any body can answer this question. please..... Siva

1488


Will down time for server and content maintenance/upgrades be allowed? how much?

609


What is meant by Output Value in UFT?

556


In QTP can we feed the out of one browser(internet explorer) as an input to the another browser(mozilla firefox)? If yes explain how to do it with an example.

1521


I got some information from the QTP help.But i am not sure whether through this process will QTP work or not bellow is the Help what I have Remote setup Settings Remote WSH, which is a new technology included in WSH 5.6, provides the ability to run a script on a remote machine or machines. With Remote WSH, the script is physically copied from the local machine to the remote machine before executing. In order to enable Remote WSH functionality, you must first set up the remote machine with the proper security settings. The steps below perform the tasks that enable Remote WSH. Note Both the remote and local machines must be running Windows NT 4 SP3 or greater in order to use Remote WSH. To enable a machine to run remote scripts 1. Install WSH V5.6 on the machine. If you are using Windows 2001 or have installed Internet Explorer 6 or greater, WSH 5.6 has already been installed. Note WSH 5.6 is available for download from the web at http://msdn.microsoft.com/scripting 2. Add yourself to the remote machine's Local Administrators group. 3. To enable Remote WSH, use Poledit.exe on the server. Note An administrator who wants to enable Remote WSH must either acquire the Windows 2000 resource kit, or use http://msdn.microsoft.com/scripting to acquire the necessary windowsscript.adm file that contains the WSH settings. The windowsscript.adm file must be copied to the server that sets the gapplicabel group's policies. Although it is not necessary to copy the file to the server's \WINNT\INF directory, this is nonetheless where the default adm files are located. Note For more information on Poledit.exe, see the Poledit.exe's online help system. 4. WSH should now be enabled on the machine. To test it,. WSH 5.6 can run scripts that reside on remote systems. The following scripts demonstrate this capability. These scripts make the assumption that the files are located on a local machine directory called "c:\wsh5.6"; change the local path and the remote machine name as necessary. After initially running RemoteTest.WSF on the local machine, there may be a small pause as DCOM verifies your identity. After you see the "Done" message, a file named "c:\beenhere.txt" on the remote machine indicates the time that you executed the command (from the remote computer's clock). Script to run scripts remotely set oController = CreateObject("WSHController") set oProcess= oController.CreateScript("c:\wsh5.6\beenhere.wsf","remmachine") oProcess. Execute Could you tell me will it work fine

1790






How is the Bitmap checkpoint different from Image checkpoint?

619


How to add verification steps to tests?

9115


If you have two monitors one is of 19inch and the 2nd one is of 24inch,if you want to write same QTP script in both the two monitors is there any changes required in the script?

1575


How to execute the WR Script through QTP? I have WinRunner script with initialization script, common scripts, GUI AND functions. I connected WR through QTP with "call to WinRunner" option but I am getting problem after connecting to WinRunner i.e. showing "Do you want to quit now" with 'yes' and 'No' message box

1821


Can an action have 2 shared object repositories associated with them? In that case, if two of them contain the same object, which one will be considered?

581


What are the common defects found in your project? (in qtp interview)

1608


Where you get the run time data table?

575


What are the types of data tables in qtp?

575


What are parameterizing tests?

541


Is it possible to use two instances of UFT on the same machine? If not why?

590