Automate website access?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
d0ughb0y
Newbie
Posts: 4
Joined: Fri Mar 29, 2019 7:14 pm

Automate website access?

Post by d0ughb0y » Mon May 20, 2019 11:11 am

I'm trying to write a script to log into Google Voice and automatically send a text message, periodically. This seemed to me to be a pretty straightforward thing to do, but it is definitely more complicated than I expected. So overall, I guess my question is how to go about this?

But one specific area I'm interested in is how to actually log into a website at all? And whether this is requiring the use of IE, which isn't really the browser I'd prefer to use. Can this be used with, say, Chrome? And if not, what's going to happen when Microsoft finally does away with IE, in favor of Edge or whatever?

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Automate website access?

Post by Dorian (MJT support) » Mon May 20, 2019 11:29 am

Have you tried the Find IE Element Wizard yet?

Start with creating an IE instance with IECreate.

Code: Select all

IECreate>IE[0]
Then navigate that instance to your login page with IENavigate.

Code: Select all

IENavigate>IE[0],http://www.mjtnet.com/,ie_res

Once you're there, you might want to add a little wait to make sure the page is loaded. Then use the IE Element Wizard I mentioned above to complete the username and password fields, and click the login button.

Regarding Chrome, Edge, and IE, this article might help. Most of us don't use IE as a browser of choice. But while we hate using it as humans, it is still generally the best choice for automation.
Yes, we have a Custom Scripting Service. Message me or go here

d0ughb0y
Newbie
Posts: 4
Joined: Fri Mar 29, 2019 7:14 pm

Re: Automate website access?

Post by d0ughb0y » Wed May 22, 2019 8:22 pm

Thanks. That was really helpful. I'm going to have to play with it more, but still. Now I am still concerned about it remaining consistent, so I think that I want it to use InPrivate mode, so it doesn't attempt to save my username for the future. Does that make sense? Or do I really not need to worry about that?

Otherwise, I think I'm going to be able to move forward okay with this.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Automate website access?

Post by Dorian (MJT support) » Thu May 23, 2019 9:58 am

It's okay if you don't want it to remember your password.

As an addition you can even make the macro detect whether you're signed in or not, and only sign in if you're not. A login page usually contains some tell-tale text. Let's say in this case it might be "forgot password". We look for that text on the page, and then use IF/ENDIF to sign in if it's found, but not if it doesn't.

Something like this (incomplete) example :

Code: Select all

//Does the page contain "forgot password"?
IEContainsText>IE[0],,forgot password,SigninReq

//If the page contains "forgot password", do this
If>SigninReq=1
  IETagEventByAttrib>.... username code here (use the IE wizard)
  Wait>0.1

  IETagEventByAttrib>.... password code here (use the IE wizard)
  Wait>0.1
  IETagEventByAttrib>.... click submit button code here (use the IE wizard)
  Wait>0.1
Endif
Yes, we have a Custom Scripting Service. Message me or go here

d0ughb0y
Newbie
Posts: 4
Joined: Fri Mar 29, 2019 7:14 pm

Re: Automate website access?

Post by d0ughb0y » Tue Jun 04, 2019 10:38 am

The issue for me isn't the remembering the password part. It's that I have multiple Google IDs that I use for different purposes. I have my business account, and my personal account, for example. And Google's services will remember them all, simultaneously. BUT, you have to make sure that you're using the one you intend to use. And It will also, often, remember my account, and already have the username selected, just waiting for the password. I don't mean that it's already filled into a field. You'd need to look at it to see what I'm talking about. But that can be complicated.

So what I'd rather do, for the purpose of scripting, is just have it log in using its own browser instance, not linked to any other extant instances that may already have credentials in place. This way I can ensure that it's using the one I want, and not have to worry about any of those issues.

d0ughb0y
Newbie
Posts: 4
Joined: Fri Mar 29, 2019 7:14 pm

Re: Automate website access?

Post by d0ughb0y » Tue Jun 04, 2019 10:54 am

Okay, maybe nevermind all that. I've been able to get it logged into the page. The new problem seems to be an IE issue. When I log in using my credentials in Chrome, I get a list of my calls, and the ability to do new things. When I try doing it from IE, even manually, it loads the page partially, but never completes. So I can't do anything more with it. Looks like I'm back to needing to use another browser?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts