Dear Sir, so sorry to trouble you again. I had tried more than a week to extract the information like description, price and the Url link website of each item. But I really can't find any way to do it, do you mind giving me a helping hand? : )
Sub AlwayUseTheToTest()
Dim WPage As Selenium.WebDriver, myUrl As String
Dim tObj As Object, myTim As Single, AColl As Object, BColl As Object
Dim noBB As Boolean, MI As Long
'
myTim = Timer
'Crea Driver:
' Set WPage = CreateObject("Selenium.EdgeDriver")
Set WPage = CreateObject("Selenium.CHRomedriver")
'
myUrl = "
toys - View all toys ads in Carousell Singapore" '<<< YOUR Url
'
WPage.Get myUrl
WPage.Wait 500
Debug.Print "Page loaded", Format(Timer - myTim, "0.0")
'
'Search the menu container:
Set AColl = WPage.FindElementsByTag("div")
Debug.Print AColl.Count
For I = 1 To AColl.Count
If InStr(1, AColl(I).Attribute("style"), "top:", vbTextCompare) = 1 Then
Debug.Print "Found menus DIV, # " & I
Exit For
End If
Next I
MI = I
'...and click the second one:
Set tObj = AColl(MI).FindElementsByTag("svg")
tObj(2).FindElementByXPath("./..").Click
WPage.Wait 500
'Search the RadioButtons Container:
Set BColl = WPage.FindElementsByTag("div")
For I = 1 To BColl.Count
If InStr(1, BColl(I).Attribute("style"), "left:", vbTextCompare) = 1 Then
Debug.Print "Found RadioButtons DIV, # " & I
Exit For
End If
Next I
'...and click the second one:
Set tObj = BColl(I).FindElementsByTag("input")
tObj(2).Click
WPage.Wait 500
Debug.Print "YOU", AColl(MI).Text
If InStr(1, AColl(MI).Text, "Recent", vbTextCompare) > 0 Then
Debug.Print "Recent has been selected"
noBB = False
Else
noBB = True
End If
Debug.Print "noBB=" & noBB
If noBB Then
AppActivate (Application.Caption)
MsgBox ("Selecting Recent failed; select it manually before closing the msgbox")
''Stop '<<< This is only for test
End If
End Sub