Navigate website through VBA

Rajneesh Rawat

New Member
Joined
Mar 31, 2017
Messages
36
Hi All,

I am trying to doing web scrapping through VBA. Login website is working perfect but m stuck in next step where i need help to choose a right property to navigate. Below is the HTML codes extract via inspect element.



and below is my VBA code:

Code:
Sub xyz()
Dim butt As Object
Dim objcoll As Object
Dim appIE As Object
Set appIE = CreateObject("internetexplorer.application")

With appIE
    .navigate "https://acme-test.uipath.com/account/login"
    .Visible = True
End With

Do While appIE.Busy

    DoEvents
Loop
    
    
Set UserN = appIE.document.getElementsByName("email")
Application.Wait (Now + TimeValue("0:00:10"))
    UserN(0).Value = "XYZ@gmail.com"

Set pswd = appIE.document.getElementsByName("password")
    
    pswd(0).Value = "abcdef"
    appIE.document.getElementById("buttonLogin").Click
    Set ojcoll = appIE.document.getElementById("/work-items").href
    appIE.document.getElementByname("/work-items").Click
'-------HTML CODE---------------
"<a href="/work-items"><button class="btn btn-default btn-lg" type="button">
<i class="fa fa-folder-open-o" aria-hidden="true"></i> Work Items</button></a>"
'--------------------------------------

   
    Set appIE = Nothing
End Sub
 
Last edited:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Re: Need help to navigate website through VBA

Below is HTML code...

HTML:
<a href="/work-items"><button class="btn btn-default btn-lg" type="button">
<i class="fa fa-folder-open-o" aria-hidden="true"></i> Work Items</button></a>
 
Last edited:
Upvote 0
Re: Need help to navigate website through VBA

Hi

Code:
Sub xyz()
Dim usern, objcoll As Object, appIE As Object, pswd, i%
Set appIE = CreateObject("internetexplorer.application")
With appIE
    .navigate "https://acme-test.uipath.com/account/login"
    .Visible = True
End With
Do While appIE.Busy
    DoEvents
Loop
Set usern = appIE.Document.getElementsByName("email")
Application.Wait (Now + TimeValue("0:00:04"))
usern(0).Value = [e2]
Set pswd = appIE.Document.getElementsByName("password")
pswd(0).Value = [e3]
appIE.Document.getElementById("buttonLogin").Click
Do While appIE.Busy
    DoEvents
Loop
Application.Wait (Now + TimeValue("0:00:04"))
Set objcoll = _
appIE.Document.getelementsbyclassname("btn btn-default btn-lg")
For i = 0 To objcoll.Length - 1
    MsgBox objcoll(i).textcontent, 64, i
Next
objcoll(1).Click
Set appIE = Nothing
End Sub
 
Upvote 0
Re: Need help to navigate website through VBA

I am glad I could help... :cool:
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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