Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
547 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Hi Andrew,
I would like to down download of element with you.
WebPage: https://sg.finance.yahoo.com/quote/MSFT/key-statistics?p=MSFT
Data: Market cap (intra-day) : 1.96T
I manage to download as 1.96 but how do I get the full underlying data of 1,957,379,833,856.0
Thanks
Hi Andrew,
Thanks for the reply. I wrote some macro in excel VBA using Selenium. but the download seems very slow, anyway to solve the issue?
Sub GetCurrency()
Call ClearCurrency
Dim ws As Worksheet
Dim SingleRow As Range
Dim ListofRows As Range
Dim SingleColumn As Range
Dim ListofColumns As Range
Dim MyRange As Range
Dim RowNum As Integer
Dim ColNum As Integer
Set ws = ThisWorkbook.Worksheets("Currency")
'=================================================================
'Setting Range
'=================================================================
With ws
Set ListofRows = Range("A3", Range("A2").End(xlDown))
Set ListofColumns = Range("B1", Range("B1").End(xlToRight))
Set MyRange = ws.Range(ListofRows, ListofColumns)
End With
'=================================================================
'Loop Through RIC
'=================================================================
RowNum = 3
For Each SingleRow In ListofRows
Dim URL As String: URL = "https://sg.finance.yahoo.com/quote/SGD=X"
Set cd = New Selenium.ChromeDriver
cd.AddArgument "--headless"
cd.Start
cd.Get URL
Application.Wait Now + TimeValue("00:00:20")
'=================================================================
'Loop Through XPATH
'=================================================================
Dim PathInput As Selenium.WebElement
Dim PathResult As Variant
ColNum = 2
For Each SingleColumn In ListofColumns
Set PathInput = cd.FindElementByXPath(SingleColumn)
cd.Wait 1000
PathResult = cd.FindElementByXPath(SingleColumn).Text
'=================================================================
'Output to Excel
'=================================================================
Cells(RowNum, ColNum).Value = PathResult
ColNum = ColNum + 1
Next SingleColumn
RowNum = RowNum + 1
Next SingleRow
Range("A1").CurrentRegion.Font.Size = 9
Range("A1").CurrentRegion.Font.Name = "Calibri"
Range(Range("c3", Range("c2").End(xlDown)), Range("C3", Range("C3").End(xlToRight))).Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
Hi,
I am trying to download some specific data from Yahoo finance, I would like to check, how do I copy the data into excel using Selenium
Sub GetData()
Dim myrng As Range
Dim lastRow As Long
Dim row_count As Long
Dim ws As Worksheet
Dim ticker As Variant
Set ws = Sheets("Main")
'=================================================================
'Find Last Row
'=================================================================
With ws
lastRow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
'=================================================================
'Find Ticker Range
'=================================================================
Set myrng = ws.Range(Cells(2, 1), Cells(lastRow, 1))
'=================================================================
'Loop Through Tickers
'=================================================================
Set cd = New Selenium.ChromeDriver
cd.Start
cd.Get https://finance.yahoo.com/quote/MSFT?p=MSFT&.tsrc=fin-srch
'=================================================================
'Finding Elements
'=================================================================
Dim SearchInput As Selenium.WebElement
Set SearchInput = cd.FindElementByXPath("/html/body/div[1]/div/div/div[1]/div/div[2]/div/div/div[5]/div/div/div/div[3]/div[1]/div/span[1]")
Thanks
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.