04-01-2013, 01:21 PM
|
VB SCRIPT to click on specific links on webpage and store related data
|
|
04-02-2013, 01:33 PM
Code: I have come up with the following code for the above problem,it runs fine for the first iteration, but it throws general run error at the second iteration, where the value of i=1. what is causing this error ??
'invoke the global site selector page
Systemutil.Run "iexplore.exe",Datatable("in_URL", dtLocalSheet),"open"
wait 10
'__________________________________________________________________________________
Set obj=Description.Create()
obj("micclass").value="Link"
Set links=Browser("EMC : Global Site Selector").Page("EMC : Global Site Selector").ChildObjects (obj)
countLinks=links.Count-3
msgbox "Num of countries" & links.Count-3
'____________________________________________________________________________________
'Create a new Microsoft Excel object
Set myxl = createobject("excel.application")
myxl.Workbooks.Open "C:\Users\accbajpa\Desktop\qtp.xls"
myxl.Application.Visible = true
'this is the name of Sheet in Excel file "qtp.xls" where data needs to be entered
set mysheet = myxl.ActiveWorkbook.Worksheets("Sheet1")
'_____________________________________________________________________________________
For i=0 to countLinks
tag= links(i).GetROProperty("name")
links(i).click
href=Browser("EMC : Global Site Selector").Page("EMC:open page").GetROProperty("url")
'_______________________________________________________________________________________
'Enter values in Sheet1.
mysheet.Range("A2").Offset(i,0).value=tag
mysheet.Range("B2").Offset(i,0).value=href
'__________________________________________________________________________________________
'go back to the page
browser("EMC : Global Site Selector").Back
Browser("EMC : Global Site Selector").Page("EMC : Global Site Selector").Sync
'________________________________________________________________________________________
Next
'________________________________________________________________________________________
'Save the Workbook
myxl.ActiveWorkbook.Save |
|
« Next Oldest | Next Newest »
|
| Possibly Related Threads… | |||||
| Thread | Author | Replies | Views | Last Post | |
| Capture All text from webpage and copy it... | mpatra | 3 | 6,019 |
07-25-2018, 05:33 PM Last Post: vimlesh |
|
|
|
Find specific records in a SwfTreeView on different node levels | lotos | 0 | 2,837 |
10-06-2017, 05:14 AM Last Post: lotos |
| Reading XML Data from a WebPage | shaan.mishra87@gmail.com | 1 | 2,642 |
09-28-2016, 09:16 PM Last Post: supputuri |
|
| How to click on all links dynamically in UFT? | Rohan | 9 | 19,879 |
02-25-2016, 10:42 AM Last Post: vinod123 |
|
| Click on calender on specific date. | venkatesh9032 | 1 | 4,464 |
12-02-2015, 07:30 PM Last Post: nistalaramesh |
|
Users browsing this thread: 1 Guest(s)

