06-05-2009, 05:12 PM
Hi,
I have following problem:
I need to drill down through the catalog via all links.
Catalog has 4 levels and each level has few links.
I'm grabbing all links on the page then following each via 'Foreach' loop. But after I'm comming back I'm not able to following next one.
Can anybody correct my procedure?
Thank you
I have following problem:
I need to drill down through the catalog via all links.
Catalog has 4 levels and each level has few links.
I'm grabbing all links on the page then following each via 'Foreach' loop. But after I'm comming back I'm not able to following next one.
Can anybody correct my procedure?
Code:
Sub DrillDown (url, level, urlback)
If level =1 Then
SystemUtil.Run "C:\Program Files\Internet Explorer\iexplore.exe","","u:\","open"
Browser("IE7").Page("Page").Sync
Browser("IE7").Navigate url
Browser("IE7").Page("Page").Sync
Dim objNames
Dim objName
Dim blnFound
End If
If Browser("IE7").Page("Result").WebElement("div").Exist(2)Then
level = 4
End If
If level=1 Then
Set objNames = Browser("IE7").Page("TGRMain").WebTable("CategoriesGrid").Object.getElementsByTagName("A")
col = Level1
Elseif level = 2 Then
Set objNames = Browser("IE7").Page("Groups").WebTable("CategoriesGrid").Object.GetElementsByTagName("A")
col = Level2
Elseif level = 3 Then
Set objNames = Browser("IE7").Page("Headings").WebTable("CategoriesGrid").Object.GetElementsByTagName("A")
col = Level3
End If
blnFound = False
lngCellCount = 0
If level <> 4 Then
For Each objName in objNames
If level = 1 or level = 2 or level = 3 Then
bu = Browser("IE7").GetROProperty("URL")
objName.Click()
Browser("IE7").Sync
Call DrillDown(domain, level+1, bu)
End if
Next 'objName
Else
Browser("IE7").Navigate urlback
Browser("IE7").Page("Page").Sync
End If
End Sub
Thank you