Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_FF_AutoLogin (V4.1) for FF.au3


  • Please log in to reply
21 replies to this topic

#1 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 09 September 2009 - 08:58 PM

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

Plain Text         
; #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, 13 November 2009 - 08:53 PM.








#2 gseller

gseller

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 1,057 posts

Posted 10 September 2009 - 03:07 AM

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

#3 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 10 September 2009 - 08:26 AM

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", "<a href='http://ff-au3-example.thorsten-willert.de/' class='bbc_url' title='External link' rel='nofollow external'>http://ff-au3-example.thorsten-willert.de/"</a>)

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

Edited by Stilgar, 10 September 2009 - 10:52 PM.


#4 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 18 September 2009 - 01:44 PM

Updated to V3.3:
- optimized the generated script
- added Default-keyword for some parameters
- some other small changes

#5 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 03 November 2009 - 04:49 PM

Updated to V3.4:

- added support for <input type='image' ...>

#6 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 07 November 2009 - 09:42 PM

V4.0:
- updated for FF.au3 >V0.6

#7 lbw87

lbw87

    Seeker

  • Active Members
  • 24 posts

Posted 13 November 2009 - 03:50 PM

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

#8 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 13 November 2009 - 05:23 PM

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, 13 November 2009 - 05:28 PM.


#9 lbw87

lbw87

    Seeker

  • Active Members
  • 24 posts

Posted 13 November 2009 - 06:54 PM

Still doesn't work.
With FF.au3 version "0.6.0.0b-5" and _FF_AutoLogin.au3 version 4.0 and pasting your code from above I get 2 errors now

Posted Image

#10 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 13 November 2009 - 08:52 PM

OK sorry I've uploaded a wrong version of the _FF_AutoLogin.
V4.1 should work.

#11 lbw87

lbw87

    Seeker

  • Active Members
  • 24 posts

Posted 13 November 2009 - 09:11 PM

where's 4.1? I can only find 4.0

#12 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 13 November 2009 - 09:39 PM

where's 4.1? I can only find 4.0

Have you reloaded it? (cache)
http://www.thorsten-willert.de/Themen/FFau3/Beispiele/FF_AutoLogin.au3

#13 lbw87

lbw87

    Seeker

  • Active Members
  • 24 posts

Posted 13 November 2009 - 10:25 PM

New errors with 4.1 ...still not working.

Posted Image

#14 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 14 November 2009 - 02:35 PM

New errors with 4.1 ...still not working.

Posted Image

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.

Edited by Stilgar, 14 November 2009 - 02:36 PM.


#15 lbw87

lbw87

    Seeker

  • Active Members
  • 24 posts

Posted 14 November 2009 - 04:49 PM

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

#16 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 14 November 2009 - 04:53 PM

_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


#17 lbw87

lbw87

    Seeker

  • Active Members
  • 24 posts

Posted 15 November 2009 - 03:59 PM

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, 15 November 2009 - 03:59 PM.


#18 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 15 November 2009 - 07:05 PM

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, 15 November 2009 - 07:06 PM.


#19 lbw87

lbw87

    Seeker

  • Active Members
  • 24 posts

Posted 16 November 2009 - 02:20 PM

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, 16 November 2009 - 02:21 PM.


#20 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 27 November 2009 - 11:29 AM

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
....

Have you tried it with the current AutoIt-version (>V3.3.0.0)?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users