u can also refer the following link * http://www.sapien.com/forums/scriptinganswers/forum_posts.asp?TID=3635&PID=21560 *
Regards Shalabh Dixit On Mon, Jul 18, 2011 at 1:09 PM, [email protected] < [email protected]> wrote: > Hi, > You can use following code..... > '-----------------------------------------------Navigate to Site > > ------------------------------------------------------------------------------' > Set objExplorer = CreateObject("InternetExplorer.Application") > objExplorer.Navigate(strURL) > objExplorer.AddressBar = 1 > objExplorer.Visible = 1 > > Do Until (objExplorer.readyState = 4) > wait 2 > Loop > nLocationURL= objExplorer.LocationURL > objExplorer.Quit > '-------------------------------------------Gettting Response Code or > Message------------------------------------------------------' > Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5.1") > objWinHttp.SetTimeouts lngTimeout, lngTimeout, lngTimeout, > lngTimeout > > If Instr(1,strURL,"http",0) =0 Then > strURL="http://"& strURL > objWinHttp.Open strMethod, strURL > Else > objWinHttp.Open strMethod, strURL > End If > If strMethod = "POST" Then > objWinHttp.setRequestHeader "Content-type", _ > "application/x-www-form-urlencoded" > End If > If strHostOverride <> "" Then > objWinHttp.SetRequestHeader "Host", strHostOverride > End If > objWinHttp.Option(0) = strUserAgentString > objWinHttp.Option(4) = intSslErrorIgnoreFlags > objWinHttp.Option(6) = blnEnableRedirects > objWinHttp.Option(12) = blnEnableHttpsToHttpRedirects > > On Error Resume Next > objWinHttp.Send(strPostData) > If Err.Number = 0 Then > If objWinHttp.Status = "200" Then > Print strURL &"Status ----------------------" & objWinHttp.Status > ' GetDataFromURL = objWinHttp.ResponseText > Else > GetDataFromURL = "HTTP " & objWinHttp.Status & " " & _ > objWinHttp.StatusText > End If > Else > GetDataFromURL = "Error " & Err.Number & " " & Err.Source & " " & > _ > Err.Description > End If > On Error GoTo 0 > Set objWinHttp = Nothing > End Function > > > Thanks, > NaveenKumar M S > > On Jul 16, 10:38 pm, "Byzoor.,IAS" <[email protected]> wrote: > > Anand, > > I am not getting your point. could u explain little bit more > > > > Happy Tester, > > Byzoor, > > > > > > > > On Sat, Jul 16, 2011 at 8:47 PM, Mr. Anand <[email protected]> wrote: > > > Hi, > > > > > I think if we have QTP use for the above scenario, its all very > > > simple. > > > Data drive the test script by putting a checkpoint on the page. Write > > > the checkpoint's output parameter to the datasheet itself. > > > I hope thats pretty easy approach subject to availability of QTP. > > > However if you donot have QTP, you can still use some of the free > > > tools available in industrty > > > > > Regards, > > > > > articlesontesting.com > > > > > On Jul 16, 7:29 pm, "Byzoor.,IAS" <[email protected]> wrote: > > > > Hi , > > > > > > After Getting the Cell value from excel sheet use this fn, it will > update > > > > the value.. > > > > > > 'To get value from Excel file > > > > Function GetData(ByVal strFilePath,ByVal strSearchText) > > > > Dim oWorkSheets > > > > Dim oExcel:Set oExcel=CreateObject("Excel.Application") > > > > oExcel.Visible=False > > > > oExcel.DisplayAlerts=False > > > > Set oWorkSheets=oExcel.WorkBooks.Open(strFilePath).WorkSheets(1) > > > > > > GetData=oWorkSheets.Cells(Split(oWorkSheets.Range("A:A").Find(strSearchText > > > ).Address,"$")(2),2).Value > > > > oExcel.Quit > > > > Set oWorkSheets=Nothing > > > > Set oExcel=Nothing > > > > strFilePath=Empty > > > > strSearchText=Empty > > > > End Function > > > > > > 'To Write the value to Excel file > > > > Function WriteData(ByVal strFilePath,ByVal strID,ByVal strData) > > > > Dim oWorkSheets,inUsedCount > > > > Dim oExcel:Set oExcel=CreateObject("Excel.Application") > > > > oExcel.Visible=False > > > > oExcel.DisplayAlerts=False > > > > Set oWorkSheets=oExcel.WorkBooks.Open(strFilePath).WorkSheets(1) > > > > inUsedCount=oWorkSheets.UsedRange.Rows.Count > > > > oWorkSheets.Cells(inUsedCount+1,1).Value=strID > > > > oWorkSheets.Cells(inUsedCount+1,2).Value=strData > > > > oExcel.WorkBooks(1).Save > > > > oExcel.Quit > > > > Set oWorkSheets=Nothing > > > > Set oExcel=Nothing > > > > strFilePath=Empty > > > > End Function > > > > > > Function ExcelDtaIO(sXls,sSht,sRow,sFld,sDta) > > > > On Error Resume Next > > > > Dim objExcel, objWorkBook, objSheet > > > > Set objExcel = CreateObject("Excel.Application") > > > > Set objWorkBook = objExcel.Workbooks.Open(sXls) > > > > Set objSheet = objWorkBook.Worksheets(sSht) > > > > > > '*** Get column number based on field name *** > > > > CurCol = 1 > > > > CurColNum = 0 > > > > Do While Trim(objSheet.Cells(1, CurCol).Value) <> Empty > > > > CurCellVal = Trim(objSheet.Cells(1, CurCol).Value) > > > > If CurCellVal = sFld Then > > > > CurColNum = CurCol > > > > Exit Do > > > > End If > > > > CurCol = CurCol + 1 > > > > Loop > > > > > > If sRow = "" Then > > > > sRow = DataTable.GetSheet(sSht).GetCurrentRow > > > > End If > > > > > > '*** Put to or Get from specific cell of current excel file > *** > > > > If sDta <> Empty Then > > > > '*** Update specific cell of current excel file *** > > > > objSheet.Cells(sRow+1, CurColNum).Value = sDta > > > > objWorkBook.Save > > > > ExcelDtaIO = Empty > > > > Else > > > > ExcelDtaIO = Trim(objSheet.Cells(sRow+1, CurColNum).Value) > > > > End If > > > > objWorkBook.Close True > > > > > > '*** Destroy objects created by this fucntion *** > > > > Set objSheet = Nothing > > > > Set objWorkBook = Nothing > > > > Set objExcel = Nothing > > > > > > End Function > > > > > > Happy Tester, > > > > Byzoor, > > > > > > On Sat, Jul 16, 2011 at 8:03 AM, uma mahesh <[email protected]> > > > wrote: > > > > > IC Ok then you can use this code > > > > > > > Option Explicit > > > > > Dim var1, var2, var3, rc, i, agent, pass > > > > > Set var1=createobject("Excel.application") > > > > > Set var2=var1.workbooks.open("path of excel sheet") > > > > > Set var3=var2.worksheets("sheet1") > > > > > rc=var3.usedrange.columns.count ' this will give the no.of links > > > > > available in the coulmn > > > > > MsgBox rc > > > > > For i=1 to rc > > > > > link=var3.cells("1", i) > > > > > Next > > > > > > > -- > > > > > You received this message because you are subscribed to the Google > > > > > "QTP - HP Quick Test Professional - Automated Software Testing" > > > > > group. > > > > > To post to this group, send email to [email protected] > > > > > To unsubscribe from this group, send email to > > > > > [email protected] > > > > > For more options, visit this group at > > > > >http://groups.google.com/group/MercuryQTP?hl=en > > > > > -- > > > You received this message because you are subscribed to the Google > > > "QTP - HP Quick Test Professional - Automated Software Testing" > > > group. > > > To post to this group, send email to [email protected] > > > To unsubscribe from this group, send email to > > > [email protected] > > > For more options, visit this group at > > >http://groups.google.com/group/MercuryQTP?hl=en- Hide quoted text - > > > > - Show quoted text - > > -- > You received this message because you are subscribed to the Google > "QTP - HP Quick Test Professional - Automated Software Testing" > group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/MercuryQTP?hl=en > -- You received this message because you are subscribed to the Google "QTP - HP Quick Test Professional - Automated Software Testing" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/MercuryQTP?hl=en
