Our training courses

Other training resources

Our training venues

Why we are different

Details for xUser

xUser has participated in the following threads:

Added by xUser on 28 Mar 2020 at 12:05

Hi Andrew

Firstly want to say your scraping series of videos are an excellent resource. I have never coded previously but they have helped me a great deal.

I am in need of some help though with the below code if possible.

Sub Portfolio_Webscrape_IE()

Dim IE As New SHDocVw.InternetExplorer
Dim HTMLDoc As New MSHTML.HTMLDocument
Dim HTMLInput As MSHTML.IHTMLElement
Dim HTMLAs As MSHTML.IHTMLElementCollection
Dim HTMLA As MSHTML.IHTMLElement
Dim URL As String

URL = "https://uk.investing.com/portfolio/"

IE.Visible = True
IE.navigate URL

Do While IE.readyState <> READYSTATE_COMPLETE
Loop

Set HTMLDoc = IE.document
Set HTMLInput = HTMLDoc.getElementById("loginFormUser_email")
HTMLInput.Value = "xxxx@xxxx.co.uk"
Set HTMLInput = HTMLDoc.getElementById("loginForm_password")
HTMLInput.Value = "xxxxx"
Set HTMLAs = HTMLDoc.getElementsByTagName("a")

For Each HTMLA In HTMLAs
If HTMLA.getAttribute("href") = "javascript:void(0)" Then
HTMLA.Click
Exit For
End If

Next HTMLA

End Sub

When I press inspect element on the “sign-in button” on the website it says:

<a class="newButton orange" onclick="loginPageFunctions.submitLogin();" href="javascript:void(0);">Sign In</a>

I've searched through many resouces but they only seem to explain how to do this if you have an actual "button" name or id or the href / rel to grab.

I would but very grateful if you can help me with my problem.  Thanks in advance.

Head office

Kingsmoor House

Railway Street

GLOSSOP

SK13 2AA

London

Landmark Offices

99 Bishopsgate

LONDON

EC2M 3XD

Manchester

Holiday Inn

25 Aytoun Street

MANCHESTER

M1 3AE

© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.

End of small page here
Please be aware that our website uses cookies!
I'm OK with this Tell me more ...