Hello everyone!
I found and modified a code here on the forum:
This code is very good and works but it only shows one data.
I can see all the data of this div in A2 cell. That's great, but what if I want more of the same div?
Webpage source code:
<div class="xxx">...</div>
<div class="xxx">...</div>
<div class="xxx">...</div>
<div class="xxx">...</div>
<div class="xxx">...</div>
if i use this code i can see the first "xxx" data in A2. It's OK, but I would like to see the second xxx in A3, the third xxx in A4...
How do I do this?
Thanks for helping!
I found and modified a code here on the forum:
VBA Code:
Sub test()
Dim WPage As Object, myUrl As String
'
'Crea Driver:
' Set WPage = CreateObject("Selenium.EdgeDriver")
Set WPage = CreateObject("Selenium.CHRomedriver")
'
Sheets("mySheet").Select
myUrl = "https://www.your.site.html"
'
WPage.Get myUrl
WPage.Wait 500
'The page is ready
'Get the text:
Range("A2").Value = WPage.FindElementByClass("xxx").Text
'Closing session:
WPage.Quit
Set WPage = Nothing
End Sub
This code is very good and works but it only shows one data.
I can see all the data of this div in A2 cell. That's great, but what if I want more of the same div?
Webpage source code:
<div class="xxx">...</div>
<div class="xxx">...</div>
<div class="xxx">...</div>
<div class="xxx">...</div>
<div class="xxx">...</div>
if i use this code i can see the first "xxx" data in A2. It's OK, but I would like to see the second xxx in A3, the third xxx in A4...
How do I do this?
Thanks for helping!