VBA - Logging in to website

BigShango

Board Regular
Joined
May 8, 2014
Messages
106
Hi,

I'm trying to write a piece of code to login to a website, and then do some other stuff like pull data etc but I'll worry about that later.

I think I understand using this to enter the username and password, and then click the submit button

Code:
doc.GetElementByID("username").Value = User
doc.GetElementByID("password").Value = Pass 
doc.GetElementByID("button").click

I understand to inspect element and get the correct IDs etc, but my issue is that I first need to click just a general large area of the first page to pop-up the login box. The area I have to click doesn't really seem to be a button or object, there's a couple of images within it but it's just a big huge area with a "LOGIN" graphic somewhere in the middle of it (my point is that it's not the LOGIN image itself, but a far larger area around it that can be clicked)

If I could somehow just say doc.MiddleOfThePage.click I think I'd be sorted but I can't figure that out.

Cheers
D
 
Last edited:

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Thanks for trying to help but I'm afraid I can't. It would be too identifiable, it's a very specific thing purpose built for the company I work for, although I'm not in a position to have them change anything on it to suit me.
 
Upvote 0
I'm not sure I can help then. Is the button actually called "button" or have you given it that name. If you right click and go to Inspect, It highlight the code on where you clicked. That might help a bit.
 
Upvote 0
The button that I want to click after I get the login and password popuo open is called button but I need to click anywhere within a large area of the initial page to get that to popup.

I think I know how to deal with the login and password popuo but I cannot get it open as I need to first click what appears to be a loosely defined large area in the middle of the page. It has a "Login" graphic in the middle of it, but the link is not tied to that graphic. Just for example, say the graphic is 1x1, the clickable area is 10x10. Inspect element can't seem to grab that area to give me a name for it.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,259
Members
452,626
Latest member
huntinghunter

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