Jump to content

_FF_AutoLogin (V4.1) for FF.au3


Stilgar
 Share

Recommended Posts

This is a auto-login function and login-function-generator for FireFox and the FF.au3

1) it tries to login on any web-page (it works at the first try on the most sites, except on the forum here :D )

2) it creates a optimized login-function for the page

; #FUNCTION# ===================================================================
; Name ..........: _FF_AutoLogin
; Description ...: Auto login for HTML-forms / Generator for login-functions
; AutoIt Version : V3.3.0.0
; Requirement(s).: FF.au3
; Syntax ........: _FF_AutoLogin($sUserName, $sPassWord[, $sURL = ""[, $sStatus = ""[, $sSubmitMode = "keypress"[, $iMode = 0[, $iFormOffset = 0]]]]])
; Parameter(s): .: $sUserName   -
;                  $sPassWord   -
;                  $sURL        - Optional: (Default = "") : login page
;                  $sStatus     - Optional: (Default = "") : Message to search on the web-page if the login was successful
;                  $sSubmitMode - Optional: (Default = "keypress") : if any methode fails the next in the list is tried
;                               | keypress
;                               | click
;                               | submit
;                               | off (fills only the inputs)
;                  $iMode       - Optional: (Default = 0) : login-only
;                               | 1: login and returns login-function
;                  $iFormOffset - Optional: (Default = 0) : offset for some sites, with multiple password-inputs
; Return Value ..: Success      - 1 / string (function)
;                  Failure      - 0
; Author(s) .....: Thorsten Willert
; Date ..........: Wed Sep 09 22:40:30 CEST 2009
; Version .......: 3.2
; ==============================================================================

Examples:

#include <FF.au3>

_FFConnect()

; logins here at the forum and creates a login script
MsgBox(0, "", _FF_AutoLogin("Username", "Password", "www.autoitscript.com/forum/index.php?app=core&module=global&section=login", "login was successful", "submit", 1, 1))

; login only
If _FF_AutoLogin("Username", "Password", "www.autoitscript.com/forum/index.php?app=core&module=global&section=login", "login was successful", "submit", 0, 1) Then MsgBox(0,"","Login was successful")

; login on the most other sites:
If _FF_AutoLogin("Username", "Password", "http://example.com", "successful") Then ;.....

The function:

_FF_AutoLogin

Edited by Stilgar
Link to comment
Share on other sites

Looks interesting, would love to see a working example? Posted Image

Doesn't the examples work for you? Oh I see you must change "password and "username" for the autoitscript.com example :D

Why don't you try it? What would you see? An example have only two lines (+includes)

#include <FF.au3>
#include "_FF_AutoLogin.au3"
_FFConnect()
_FF_AutoLogin("Username", "Password", "http://ff-au3-example.thorsten-willert.de/")

that's all. OK this one throws an 404-page :D

Edited by Stilgar
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

I'm getting a _FFDispatchEvent error when checking syntax. Here's my code and a screenshot...am I doing something wrong?

#include <FF.au3>
#include <FF_AutoLogin.au3>

If _FFConnect () Then
$open = _FFWindowOpen("www.gmail.com")
_FFloadwait($open)
WinActivate($open)
_FF_AutoLogin("user","password")
EndIf

Posted Image

Yes, like I said one post before: It's updated for FF.au3 V0.6:

http://thorsten-willert.de/Themen/FFau3/Testversion/FF_06.au3

And some corrections in your script:

#include <FF.au3>
#include <FF_AutoLogin.au3>

If _FFConnect () Then
  _FFWindowOpen("www.gmail.com") ; activates the window per default / loadwait is build in now
  _FF_AutoLogin("user","password")
EndIf
Edited by Stilgar
Link to comment
Share on other sites

Hmm - here it works (FF 3.5.5 / FF.au3 V0.6 / _FF_AutoLogin V4.1)

Can you show me a copy (text) of the console-output, please? This picture is not good to read.

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.2.12.1

_FFConnect: FF.au3: 0.6.0.0b-5

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1716

__FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)

__FFSendJavascripts: Sending functions to FireFox .__FFWaitForRepl ==> MozRepl Exception: !!! [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"

......... done

_FFWindowOpen: http://www.gmail.com

_FFLoadWait: . loaded in 151ms

_FFWindowGetHandle:

_FFWindowGetHandle ==> General Error

__FFSendJavascripts: Sending functions to FireFox .......... done

__FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';};

__FFRecv: 0

__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;};

__FFRecv: 0

>Exit code: 0 Time: 3.276

Link to comment
Share on other sites

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.2.12.1

_FFConnect: FF.au3: 0.6.0.0b-5

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1716

__FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)

__FFSendJavascripts: Sending functions to FireFox .__FFWaitForRepl ==> MozRepl Exception: !!! [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"

......... done

_FFWindowOpen: http://www.gmail.com

_FFLoadWait: . loaded in 151ms

_FFWindowGetHandle:

_FFWindowGetHandle ==> General Error

__FFSendJavascripts: Sending functions to FireFox .......... done

__FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';};

__FFRecv: 0

__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;};

__FFRecv: 0

>Exit code: 0 Time: 3.276

Seems to be a problem with _FFWindowOpen.

Habe you tried something like this with an open FireFox, too:

#include <FF_AutoLogin.au3>

If _FFConnect () Then
  _FF_AutoLogin("user","password", "www.gmail.com")
EndIf
Link to comment
Share on other sites

nope...doesn't work. Below are the errors

Both sets of code seem to open the Gmail webpage but then just sits there and doesn't login..

Autologin logs into gmail for you with both sets of code that you said to use?

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.2.12.1

_FFConnect: FF.au3: 0.6.0.0b-5

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1716

__FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)

__FFSendJavascripts: Sending functions to FireFox .......... done

_FFOpenURL: http://www.gmail.com

__FFSend: try{window.content.top.document.location.href='http://www.gmail.com';}catch(e){'_FFCmd_Err';};

__FFRecv: http://www.gmail.com

_FFLoadWait: .. loaded in 297ms

__FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';};

__FFRecv: 2

__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;};

__FFRecv: 1

__FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF996"+this.obj.snapshotItem(i).type;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;};

__FFRecv: 15FF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996hiddenFF996textFF996passwordFF996checkboxFF996hiddenFF996submitFF996hidden

__FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF839"+this.obj.snapshotItem(i).id;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;};

__FFRecv: 15FF839FF839FF839continueFF839serviceFF839rmFF839ltmplFF839ltmplFF839sccFF839FF839EmailFF839PasswdFF839PersistentCookieFF839FF839FF839asts

__FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF552"+this.obj.snapshotItem(i).name;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;};

__FFRecv: 15FF552ltmplFF552ltmplcacheFF552continueFF552serviceFF552rmFF552ltmplFF552ltmplFF552sccFF552GALXFF552EmailFF552PasswdFF552PersistentCookieFF552rmShownFF552signInFF552asts

__FFSend: try{FFau3.simulateEvent(,'KeyboardEvent','keypress',13);}catch(e){'_FFCmd_Err';};

__FFSend: ;

__FFWaitForRepl ==> Error return value: MozRepl ....>

__FFRecv:

_FFLoadWait: .. loaded in 297ms

>Exit code: 0 Time: 3.066

Edited by lbw87
Link to comment
Share on other sites

nope...doesn't work. Below are the errors

Both sets of code seem to open the Gmail webpage but then just sits there and doesn't login..

Autologin logs into gmail for you with both sets of code that you said to use?

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.2.12.1

_FFConnect: FF.au3: 0.6.0.0b-5

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1716

__FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)

...

Yes, my last example works for me. Have you tried it with current version (V3.5.5) of FireFox, too? Edited by Stilgar
Link to comment
Share on other sites

yes, just upgraded to 3.5.5 and still sits on the gmail.com webpage without ever logging in(with the correct credentials of course)...

_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3

_FFConnect: AutoIt: 3.2.12.1

_FFConnect: FF.au3: 0.6.0.0b-5

_FFConnect: IP: 127.0.0.1

_FFConnect: Port: 4242

_FFConnect: Delay: 2ms

_FFConnect: Socket: 1692

__FFSend: try{window.content.top.document.browserDOMWindow}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{navigator.userAgent}catch(e){'_FFCmd_Err';};

__FFRecv: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)

_FFConnect: Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)

__FFSendJavascripts: Sending functions to FireFox .......... done

_FFOpenURL: http://www.gmail.com

__FFSend: try{window.content.top.document.location.href='http://www.gmail.com';}catch(e){'_FFCmd_Err';};

__FFRecv: http://www.gmail.com

_FFLoadWait: ... loaded in 709ms

__FFSend: try{window.content.top.document.forms.length}catch(e){'_FFCmd_Err';};

__FFRecv: 2

__FFSend: FFau3.xpath=null;try{FFau3.xpath=window.content.top.document.evaluate("count(//form[1]//input[@type='password'])",window.content.top.document,null,XPathResult.NUMBER_TYPE,null).numberValue;}catch(e){'_FFXPath_Error: '+e;};

__FFRecv: 1

__FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF268"+this.obj.snapshotItem(i).type;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;};

__FFRecv: 15FF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268hiddenFF268textFF268passwordFF268checkboxFF268hiddenFF268submitFF268hidden

__FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF221"+this.obj.snapshotItem(i).id;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;};

__FFRecv: 15FF221FF221FF221continueFF221serviceFF221rmFF221ltmplFF221ltmplFF221sccFF221FF221EmailFF221PasswdFF221PersistentCookieFF221FF221FF221asts

__FFSend: FFau3.xpath=null;try{with(FFau3){this.obj=window.content.top.document.evaluate("//form[1]//input",window.content.top.document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);this.tmp=this.obj.snapshotLength;for(var i=0;i<this.obj.snapshotLength;i++){this.tmp+="FF765"+this.obj.snapshotItem(i).name;};this.tmp;}}catch(e){'_FFXPath_Error: ' +e;};

__FFRecv: 15FF765ltmplFF765ltmplcacheFF765continueFF765serviceFF765rmFF765ltmplFF765ltmplFF765sccFF765GALXFF765EmailFF765PasswdFF765PersistentCookieFF765rmShownFF765signInFF765asts

__FFSend: try{FFau3.simulateEvent(,'KeyboardEvent','keypress',13);}catch(e){'_FFCmd_Err';};

__FFSend: ;

__FFWaitForRepl ==> Error return value: MozRepl ....>

__FFRecv:

_FFLoadWait: .. loaded in 293ms

Edited by lbw87
Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...