import data from Web

newnew005

New Member
Joined
Apr 22, 2020
Messages
12
Office Version
  1. 2019
Platform
  1. Windows
Dear ALL,

I follow your video, I want to import data from Web of this link https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx

When I run from web, in explore I read the link, document, does not have TABLE, but I can read table and data, on TABLE VIEW and DATA VIW, when I press LOAD or CHANGE, it load a table only, no data. Please teaching me what is my mistake and how to do? THX! 擷取.PNG
 
Dear Worf, I don't know where to read the date. THX!1589000798005.png4.PNG5.PNG
1589000798005.png
4.PNG
5.PNG
1589000798005.png4.PNG5.PNG
1589000798005.png
4.PNG
1589000798005.png4.PNG

1589000798005.png4.PNG
5.PNG

Tell me what is your Chrome version and the date of the Chrome driver executable file in the Selenium basic directory.

My info is 81.0.4044.129 and 15/3/20.
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
It is weird because you seem to have the correct driver. Anyway, let’s check the date.

Windows file explorer > right click > show > details.
 
Upvote 0
Yes, I read your link, I know chrome version and selenium version.

It is weird because you seem to have the correct driver. Anyway, let’s check the date.

Windows file explorer > right click > show > details.
 
Upvote 0
That message box is a test to check if the code can find the table.
I will now write a version that actually transfers the table data to the worksheet, which I assume is what you want.
 
Upvote 0
This one transfers the table:

VBA Code:
Public dr As New ChromeDriver

Sub HongKongFoo()
Dim pt As WebElement, i%, j%, k%
dr.get "https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx"
Set pt = dr.FindElementByXPath("/html/body/div[1]/div[3]/div/table")
For i = 1 To pt.FindElementsByTag("tr").Count                                   ' table rows
    j = 1
    For k = 1 To pt.FindElementsByTag("tr")(i).FindElementsByTag("td").Count    ' columns
        Cells(i, j) = pt.FindElementsByTag("tr")(i).FindElementsByTag("td")(k).Text
        j = j + 1
    Next
Next
Application.CutCopyMode = False
ActiveSheet.ListObjects.Add(xlSrcRange, [a1].CurrentRegion, , xlYes).Name = "Table2"
ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleMedium12"
End Sub
 
Upvote 0
Dear Worf,

3.PNG
press debugged

3.PNG4.PNG

THX!



Sub HongKongFoo()
Dim pt As WebElement, i%, j%, k%
dr.get "https://racing.hkjc.com/racing/information/english/Racing/JockeysRides.aspx"
Set pt = dr.FindElementByXPath("/html/body/div[1]/div[3]/div/table")
For i = 1 To pt.FindElementsByTag("tr").Count ' table rows
j = 1
For k = 1 To pt.FindElementsByTag("tr")(i).FindElementsByTag("td").Count ' columns
Cells(i, j) = pt.FindElementsByTag("tr")(i).FindElementsByTag("td")(k).Text
j = j + 1
Next
Next
Application.CutCopyMode = False
ActiveSheet.ListObjects.Add(xlSrcRange, [a1].CurrentRegion, , xlYes).Name = "Table2"
ActiveSheet.ListObjects("Table2").TableStyle = "TableStyleMedium12"
End Sub[/CODE]
[/QUOTE]
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top