Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get all links in a page
#1
Not Solved
Scenario:
In my application there are many links, by clicking each and every link the
1. Click the hyperlinks
2. Then "File Download" dialouge appears we have to save file name in any drive (C or D)
2. After saving file then get row count in xls file.

Note: I have done above scenario by recording and writing script, it was working without any issues. Refer below code FYI

I have many kind of scenarios to validate xls row count. Is there any other way to write code optimization like function or Descriptive programming? Kindly suggest your approach.
Please refer below code FYI

Code:
Window("Lilly Science Grid").Page("Page_3").Link("25").Click    // clicking link
wait(2)
rowCnt = Window("Lilly Science Grid").Page("Page_3").Link("25").GetROProperty("text")
convLng = CLng(rowCnt)
msgbox rowCnt
wait(3)
SwfWindow("Lilly Science Grid").Dialog("File Download").Click 285,18  // QTP generated script
SwfWindow("Lilly Science Grid").Dialog("File Download").Activate // QTPgenerated script
SwfWindow("Lilly Science Grid").Dialog("File Download").WinButton("Save").Click //
wait(5)
Dialog("Save As").Activate
Dialog("Save As").WinEdit("File name:").Set "D:\tumo.xls"
Dialog("Save As").WinButton("Save").Click
Dialog("Save As_2").WinButton("Yes").Click
Dialog("Download complete").Click 321,184
Dialog("Download complete").WinButton("Close").Click

fileName = "D:\tumo.xls"
Set xlObj = CreateObject ("Excel.Application")
Set wBook = xlObj.workBooks.Open(fileName)
Set sheetName = wBook.worksheets("Sheet1")
'Set sheet = xlObj.ActiveWorkbook.worksheets("sheet1")
column_count = sheetName.usedrange.columns.count
row_count = sheetName.usedrange.rows.count
xlsRowCnt = row_count -1
msgbox xlsRowCnt

If xlsRowCnt = convLng Then
reporter.ReportEvent micPass, "Row Count Validation","Row Count matching with column header. Step.Pass"
else
reporter.ReportEvent micFail, "Row Count Validation","Row Count is not matching with column header.Step.Fail"
End If
wBook.close

Thanks for your help.
Sekhar


Attached Files Image(s)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  I want to click on all the links in the webtable. These links are nothing but some co abhideshpande001 0 2,560 07-22-2015, 09:36 AM
Last Post: abhideshpande001
  Unable to get total number of links on a web page RGummadidala 4 4,313 02-17-2011, 06:47 AM
Last Post: RGummadidala
  How to capture the links in web page estherindu 1 2,274 12-12-2009, 10:34 PM
Last Post: upadhyay40

Forum Jump:


Users browsing this thread: 1 Guest(s)