Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB SCRIPT to click on specific links on webpage and store related data
#1
Not Solved
Hi, I am new to DP, I need to automate the following scenario.

open http://www.emc.com/utilities/globalsiteselect.jhtml

then one by one click on all the country name displayed on the webpage ie afganistan, albania, algeria.....till Zambia, and for each country link clicked, record the URL its navigating to and the country name displayed at the right top of page, for example when you click Afghanistan it opens http://middle-east.emc.com/index.htm?fro...SiteSelect and the country name displayed at the right top is Middle East. so the result should be
Afghanistan-->http://middle-east.emc.com/index.htm?fromGlobalSiteSelect--> Middle East
Please help. I badly need to automate .
Reply
#2
Not Solved
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Capture All text from webpage and copy it... mpatra 3 4,883 07-25-2018, 05:33 PM
Last Post: vimlesh
Question Find specific records in a SwfTreeView on different node levels lotos 0 2,198 10-06-2017, 05:14 AM
Last Post: lotos
  Reading XML Data from a WebPage shaan.mishra87@gmail.com 1 2,021 09-28-2016, 09:16 PM
Last Post: supputuri
  How to click on all links dynamically in UFT? Rohan 9 17,872 02-25-2016, 10:42 AM
Last Post: vinod123
  Click on calender on specific date. venkatesh9032 1 3,725 12-02-2015, 07:30 PM
Last Post: nistalaramesh

Forum Jump:


Users browsing this thread: 1 Guest(s)