Sign in to follow this  
Followers 0
taurus905

IE.au3 Gmail Login Problem

9 posts in this topic

I am trying to write a simple script to login to my email account at gmail.com

but the browser cycles from one url to another and will not login.

I did have this working at one time. I'm not sure what happened.

Can anyone see what I am doing wrong or have any suggestions?

If you have a gmail acount, you can substitute your username for ValidUSERNAME and your password for ValidPASSWORD in the script.

If you run this code as is, you will also see it cycle.

Thanks in advance.

taurus905

; Gmail_Login.au3
#include <IE.au3>

; Create a browser window and navigate to gmail
$oIE = _IECreate()
_IENavigate($oIE, "http://www.gmail.com")

; get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "gaia_loginform")
$o_login = _IEFormElementGetObjByName($o_form, "Email")
$o_password = _IEFormElementGetObjByName($o_form, "Passwd")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "ValidUSERNAME")
_IEFormElementSetValue($o_password, "ValidPASSWORD")
_IEFormSubmit ($o_form)
WinSetState( "", "", @SW_MAXIMIZE)
Exit

As I was writing this post, I tried it again and it showed the login page which asked me to enter my password again, along with the characters in a .jpg for visual verification.

So I am guessing gmail does not like automated login for security reasons. :D

I could be wrong.


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites



I tried this with IE.au3 T2.0-3 and my Gmail account and it worked.

I see no way that the form could know that it is being submitted programmatically.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

I tried this with IE.au3 T2.0-3 and my Gmail account and it worked.

I see no way that the form could know that it is being submitted programmatically.

Dale

DaleHohm,

I am glad that you have a gmail account. I am using IE.au3 T2.0-3 also.

It worked for me at first also. Please try it a few more times. It seems to be inconsistent.

I hope others will try it also.

Thanks.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

With the lastest version of IE.au3 (T2 0_3) I have an other problem in a login script. It hang on line 566 :D :

Until ($oTemp.document.readyState = "complete" Or $oTemp.document.readyState = 4 Or $f_Abort)

To fix this problem, I add @error <> 0 at the end, like that :

Until ($oTemp.document.readyState = "complete" Or $oTemp.document.readyState = 4 Or $f_Abort Or @error <> 0)

And now it work fine :D

Share this post


Link to post
Share on other sites

With the lastest version of IE.au3 (T2 0_3) I have an other problem in a login script. It hang on line 566 :D :

Until ($oTemp.document.readyState = "complete" Or $oTemp.document.readyState = 4 Or $f_Abort)

To fix this problem, I add @error <> 0 at the end, like that :

Until ($oTemp.document.readyState = "complete" Or $oTemp.document.readyState = 4 Or $f_Abort Or @error <> 0)

And now it work fine :D

Yes, In fact I see this too. Gmail does a lot of funky things - it is an Ajax application and is doing a lot of page rewriting and doesn't follow the typical flow.

I don't recommend making the change that you made at line 566 because it has larger implications. What I do recommend is changing _IEFormSubmit call so that it does not call _IELoadWait for you:

_IEFormSubmit($oForm, 0)
This will return control to your script directly after performing the submit.

What is actually happening is that _IELoadWait is trapping the following COM Error:

--> COM Error Encountered in tmp-sbsrn.au3

----> $IEComErrorScriptline = 566

----> $IEComErrorNumberHex = 000000A9

----> $IEComErrorNumber = 169

----> $IEComErrorWinDescription = Variable must be of type 'Object'.

----> $IEComErrorDescription = Access is denied.

----> $IEComErrorSource =

----> $IEComErrorHelpFile = C:\WINDOWS\system32\mshtml.hlp

----> $IEComErrorHelpContext = 0

----> $IEComErrorLastDllError = 0

_IELoadWait presumes that a COM error received at this point is transient. This one is not unfortunately and it continues to try until the timeout (default 5 min) is reached. This turns out to be the same error you get if you violate cross-domain Frame scripting restrictions and I trap for the error in Frames, display a warning and bail out. I can do the same here.

This _IELoadWait code has been the biggest challenge of the entire project. There are so many variations and pitfalls.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

DaleHohm,

I am glad that you have a gmail account. I am using IE.au3 T2.0-3 also.

It worked for me at first also. Please try it a few more times. It seems to be inconsistent.

I hope others will try it also.

Thanks.

taurus905

I am getting a run-time error. "Line 11. Object Expected" whether I login interactively or programmatically.

If I Ok the error I login fine. Do you have this?

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

I am getting a run-time error. "Line 11. Object Expected" whether I login interactively or programmatically.

If I Ok the error I login fine. Do you have this?

Dale

DaleHohm,

I never gotten the run-time error. "Line 11. Object Expected" you are getting.

I substituted

Send("{enter}")

for

_IEFormSubmit ($o_form)

and now my script doesn't hang on _IEFormSubmit ($o_form) and time-out in five minutes like you mentioned.

But whenever my script causes gmail to endlessly cycle through urls, I need to reboot in order to be able to login to my email. Just logging off windows doesn't fix it. I need to reboot. I am not sure what is causing this. I will post again if I can narrow it down to certain steps that cause this problem.

Thanks for your time.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

I have decided to use the following code to login to gmal.com because it works every time.

; Gmail - Login.au3
#include <IE.au3>
$oIE = _IECreate("http://www.gmail.com")
WinSetState( "Welcome to Gmail - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
$username = "Replace_with_your_username"
$password = "Replace_with_your_password"
Send($username)
Send("{tab}")
Send($password)
Send("{enter}")
Exit

And I use this code to login to the AutoIt Forum.

; AutoIt Forum - Login.au3
#include <IE.au3>
$o_IE = _IECreate ("http://www.autoitscript.com")
WinSetState("AutoIt Script Home Page - Microsoft Internet Explorer", "", @SW_MAXIMIZE)
$username = "Replace_with_your_username"
$password = "Replace_with_your_password"
_IEClickLinkByText ($o_IE, "forum")
_IEClickLinkByText ($o_IE, "Forums")
_IEClickLinkByText ($o_IE, "LogIn")
For $i = 1 To 13
    Send("{tab}")
Next
Send($username)
Send("{tab}")
Send($password)
Send("{enter}")
Exit

Thanks DaleHohm.

taurus905


"Never mistake kindness for weakness."-- Author Unknown --"The highest point to which a weak but experienced mind can rise is detecting the weakness of better men."-- Georg Lichtenberg --Simple Obfuscator (Beta not needed.), Random names for Vars and Funcs

Share this post


Link to post
Share on other sites

Sorry we couldn't resolve this, but I was never able to reproduce your problem. I never saw confirmation that you tried _IEFormSubmit($oForm, 0) to prevent the _IELoadWait (this issue is worked around in the next release by trapping for the Access Is Denied COM error).

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0