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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

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