WEB SCRAPPING ERROR

NIPUL JARIWALA

Board Regular
Joined
Apr 22, 2016
Messages
55
Hello everyone,
I am trying to get some data form a web which I need daily and I lost lot of my time in it.
So I am trying to write a code to make my job easy.
For that I need to log in to the website.
But I am facing difficulty to login.
Please help me

my vba code:
Sub web_data()
Dim CH As Selenium.ChromeDriver
Set CH = New Selenium.ChromeDriver
CH.Start
CH.Get "Login Template Title"

CH.FindElementById("58:2;a").SendKeys "id"
CH.FindElementById("71:2;a").SendKeys "passwod"
CH.FindElementsByClass("slds-button slds-button--brand loginButton uiButton--none uiButton").Click 'here I face error
End Sub

I got an error on last line of code




And here is HTML code of element:
html code.jpg

Please help me to solve my problem

Thank you
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi

try xpath
VBA Code:
CH.FindElementByXPath("/html/body[1]/div[2]/div[2]/div/div[2]/div/div[3]/div/div[3]/button").Click

this replaces

VBA Code:
CH.FindElementsByClass("slds-button slds-button--brand loginButton uiButton--none uiButton").Click    'here I face error

good luck

dave
 
Upvote 0
in fact, i tried it, it seems to work sometimes.

maybe due to page not loading

so try this.

VBA Code:
Sub web_data()
Dim CH As Selenium.ChromeDriver
Set CH = New Selenium.ChromeDriver
CH.Start
CH.Get "https://giaportal.force.com/clientportal/s/login/?_ga=2.138811059.1290997332.1668610683-212414801.1667894107"

CH.FindElementById("58:2;a").SendKeys "id"
CH.FindElementById("71:2;a").SendKeys "passwod"

TRY_AGAIN:
On Error GoTo TRY_AGAIN
CH.FindElementByXPath("/html/body[1]/div[2]/div[2]/div/div[2]/div/div[3]/div/div[3]/button").Click
On Error GoTo 0

End Sub
 
Upvote 0
Another option for that line:
VBA Code:
CH.FindElementsByClass("loginButton")(1).Click
 
Upvote 0

Forum statistics

Threads
1,223,996
Messages
6,175,861
Members
452,676
Latest member
woodyp

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