Information like the ID or the name like the labels and so on which you can use to you know um control the web pages for using BBA itself okay so first thing I'll go to uh this web page called um.
Basically um Gmail where we can log into the Gmail mail.google.com so first thing we are prompted here is to enter the email ID okay enter your email ID and click on.
Next so before we can um input the email ID here and click on next we need to find out what are name of you know this input box and this button basically so I'll right click on it and uh click on.
Inspect element you can do the same thing for um from any browser like Chrome or from Firefox I'm using Internet Explorer for now so here is the input name input name is email ID is.
Email spell check fals type and all this okay so this is the attributes of this particular input box so what you can do is just right click on it and then copy the you know.
Information and then I'll just put it here for now on top okay so we can refer it back later so similarly I'll do it for um I'll just scroll down a bit and then.
Do inspect El for the button next Button as well oh sorry so when I click on uh inspect on this input name is sign in and then the.
ID is next okay we need to be concerned more about the ID because that's the that's the one we're looking for and then um the other information or you know the attribute information is good.
To know but we are not using that for now so I'll do the same thing I'll copy this and I'll put this on top okay as a comment so similarly you'll put in your email ID here for.
Example um gmail.com and then click on next so we prompted to put in the password I'll do inspect element for this password uh input field the ID is password pass WD.
Posts Related:
- Export bulk data to Excel using from database - Oledb .NET E23
- How to make Flex Design in Banner Photoshop cs Ready to Print
- Excel VBA Advanced Tutorial
Basically I'll just back this up here as
Well so this is a password and then if you want uh keep yourself signing this this is checkbox so I'm going to inspect element on this as.Well yep on this one and this is input name is persistent cookie okay so just copy this as well and then the final thing we need to do here is click on sign in.
Okay so I'll inspect the element for the sign in Button as well so this is sign in I'll copy this and then I'll come back and back it up here so the name uh the ID for this is.
Sign in okay so these are the buttons and the input box that we be working on with our code down here which I've already written to save us some time but I'll walk you through it and everything.
So I'll just close this for now okay so basically this function requires three things to be passed so the username is basically the email ID and then the password and then uh.
Persistent cookie this basically give me sign in sign in okay as bullin and then the password and the email ID as string and then this is supposed to.
Return true or false I'll just make this bullying so if it's sign in successfully it will return true else false okay so first thing before you start writing the code to manipulate the HTML document is.
To go to tools from your editor and then click on reference and then from here you can uh you need to select two things one is the internet controls Microsoft Internet.
Controls and then the other thing is Microsoft HTML object Library so um if you don't find this on Top This the names are sorted you know alphab alphabetically so scroll down and then.
Uh reference into these two
Libraries okay and then after you check these two boxes click on okay I'll just cancel it for now because I've already done it so the first thing is I'm.Declaring the the uh basically the Internet Explorer and the document so this part and then this is declaring that um uh so this is uh early binding as in like uh you're declaring you know.
The objects and then manipulating using them you know uh uh accordingly as you've declared so the password is uh Microsoft HTML input element so similarly I've declared uh that these.
Are my variables okay this is my basically Internet Internet Explorer and then the document and then these are my password the user ID is basically.
The let me just reorder this a little bit so this is email and then this is password that this is to click on um I'll put in order so that uh it's.
Good so click on next uh this is declaring that my ntbt is the the next button okay going to be my next button so oh this is sign in button there's sign.
In and then this is before signing um you know this is the button that checkbox that we check it if we want to keep ourselves signing okay so this give me.
Sign in for example so going straight down if there's error just skip to the bottom that's the this is what it is doing and then here I'm setting you know the object and then this is my.
Explorer and then from this uh Explorer I'm navigating into the URL so the URL is this and then um you know basically this line is uh with the two semicolon this is basically is like this so this.
Part is basically waiting for the web page to load okay and then um I'm setting that um the IE document will be the document that is loaded and then I'm saying just.
Make it visible this part is to make it visible so if you don't want if you want to sign in without making the browser visible uh uh you can just turn this to false so after reaching here I'm.
Basically saying you know just wait for 2 seconds so now Plus application wait now plus 2 seconds here okay so for example if I just make this to0 0 and then like this two seconds as soon.
As you hit enter it automatically changes to 12 okay so basically I'm saying here wait for two seconds and then um saying that uh from this browser find the button input box called email.
Okay so the first thing we found was the ID email so I'm saying that the user ID variable fill is equal to um the item called email okay and then similarly the next.
Button so the next button ID is itself next ID is next okay so here I'm saying that uh user ID fill is the one with the email ID and then next button is the one with next ID.
Okay and then after I uh um set the object I'm putting a value so whatever uh whatever email ID you're passing here is going to be you know that particular user ID field is going to be your email.
ID here that is the variable you'll be passing on okay after putting the email ID I'm waiting for two seconds again because you can enter the you can enter the email ID that fast right so I'm just.
Um giving some time okay after that after waiting for two minutes I'm saying next button do click okay so after putting the email ID I'm saying click on it after clicking on it I'm saying wait.
For two one more second and then I'm saying the password fill is going to be the FI with uh with the input box ID called password this the one we found it out here ID is.
Password um so as you know these are just the commments for our ref difference so similarly I did it for U you know keep me sign in checkbox is equal to the one with the ID called.
Persistent cookie and then I'm saying person cookie will be the one remember me whatever you pass it as a variable here so if you put this to true if you put this to true it just.
Going to be checked if you make it to false it's going to be unchecked okay so after putting that after putting the password after checking the Box you know as part.
Your reference uh you know the par parameters that you've passed and then after waiting for 3 seconds is going to click on the signin button so for the signin button here I got a little bit.
Lost um so I'm thinking that there are you know multiple signin buttons just I'm not sure why it's set up in that manner by Google but um so I'm saying um the index is going to be one so from the.
Multiple sign in buttons that are there just refer to the one with one index so that's how I was trying with zero as well and then I tried with one and it worked okay so we're saying that uh the.
Signin button is going to be the web element with the ID sign in and then the index is one okay so once that is set I'm saying click on uh sign in button. Click and then wait for the web browser.
To load okay so let's try it out um so login Gmail ID sub test the code so let's test our function so I'll say call and then I'll put in my so first thing is the user ID that I need to pass so.
I'll say bb. xprd gmail.com just ensure that everything is correct and the password is the one I've already assign earlier.
It's called password X and then I'll say don't keep me signing so I'll say false okay so when I run this I'm expecting that this code is going to load the.