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 have an question.
This is original screen,
original.PNG
second row number is hosrizontal
when I copy & paste, it change to vertical. Please tell me how to FIX it. THX!
7.PNG
 
Upvote 0

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Regarding the first question, maybe you forgot the second line shown below. Use the first line to force variable declarations.

VBA Code:
Option Explicit

Public dr As New ChromeDriver

Sub HongKongFoo()
 
Upvote 0
Regarding post #21, where is that screen on the site? I am not finding it.
 
Upvote 0
Yes, you need to install it. This can be a bit of work but is done only once, and after that you have a great tool.

Below I am providing three links and the explanations.

Link 1 – Selenium download page

Selenium Basic

Link 2 – General process overview

Excel VBA Selenium

Link 3 – Chrome driver download

Chromium

  • Install Selenium from the first link
  • Add a reference to it in the VBE, as shown on the second link
  • Check if the installed Chrome driver executable file is compatible with the Chrome version you are using. You can do that by downloading it from the third link and comparing the dates. If they are different, replace the installed one with the downloaded one, as shown on the picture below. Note that it is the Selenium Basic folder.
If all went well, the VBA code should run now; tell us how it goes…

View attachment 12345
Hi Worlf,

I have go through above three steps but I have received runtime error 33 messages. I should mention that my chrome version is Version 87.0.4280.88 (Official Build) (64-bit).

1609329407288.png
 
Upvote 0
hi Wolf,
please help me, your method is the only one that works for me, how to scrape the data when the site wants to login first and only then is the data, I can't figure out how to create a login code in selenium.
thank you very much
 
Upvote 0
my code:

Sub EVA()
Dim driver As New WebDriver
Dim rowc, cc, columnC As Integer
rowc = 2
Application.ScreenUpdating = False
driver.Start "chrome"
driver.Get "Drogerie - Osvěžovače vzduchu"
For Each h2 In driver.FindElementByClass("zitembox").FindElementByClass("zspacer").FindElementsByClass("pb-1")
cc = 1
For Each t In h2.FindElementsByTag("h2")
List1.Range("A2").Value = t.Text
cc = cc + 1
Next t
Next h2
For Each stbox In driver.FindElementByClass("zitembox").FindElementByClass("zspacer").FindElementsByClass("stbox")
columnC = 1
For Each st_onstore In stbox.FindElementsByClass("st_onstore")
List1.Range("B2").Value = st_onstore.Text
columnC = columnC + 1
Next st_onstore
rowc = rowc + 1
Next stbox
Application.Wait Now + TimeValue("00:00:20")

End Sub

I need all products from this category but also prices, I couldn't get the prices out
 

Attachments

  • VBA.png
    VBA.png
    14 KB · Views: 12
Upvote 0
I cannot access it. Can you post the entire HTML code for the page?

denied.PNG
 
Upvote 0
  • You can post it directly as shown below.
  • If it is too big, upload to a hosting site like Drop Box and paste a link here.
  • If all else fails I can give you my email address.
Rich (BB code):
<!DOCTYPE html>
<html id="XF" lang="en-US" dir="LTR"
    data-app="public"
    data-template="thread_view_type_question"
    data-container-key="node-10"
    data-content-key="thread-739807"
    data-logged-in="true"
    data-cookie-prefix="xf_"
    data-csrf="1616268006,20f8f1ca03a9229d58d4372080e56821"
    class="has-no-js template-thread_view_type_question"
    >
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
 
Upvote 0

Forum statistics

Threads
1,215,694
Messages
6,126,258
Members
449,307
Latest member
Andile

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