Dizzy Posted August 12, 2006 Share Posted August 12, 2006 Hi all,i want to automate my login at "mail.hansenet.de" but i cant get the fields.I search for forms with:#include <IE.au3> $oIE = _IECreate ("http://mail.hansenet.de") $oForms = _IEFormGetCollection ($oIE) MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page") For $oForm In $oForms MsgBox(0, "Form Info", $oForm.name) Nextbut i get no forms ...so i try to get frames ...#include <IE.au3> $oIE = _IECreate() _IENavigate($oIE, "http://mail.hansenet.de") $oFrames = _IEFrameGetCollection ($oIE) $iNumFrames = @extended For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl")) NextThat gives me 2 "Frame Infos".1.) http://mail.hansenet.de/supp/blank.htm2.) http://mail.hansenet.de/mail/Login?domain=...ult&plain=0How can i work with this info? How do i get the right fields to insert my credentials?Thanks Link to comment Share on other sites More sharing options...
DaleHohm Posted August 12, 2006 Share Posted August 12, 2006 Looking at the source of the page you'll see: <FRAMESET ROWS="1,1000" BORDER="0" FRAMEBORDER="0"> <FRAME SRC="/supp/blank.htm" SCROLLING="NO" NAME="SessionFrame"> <FRAME SRC="/mail/Login?domain=hansenet.de&style=default&plain=0" SCROLLING="no" NAME="SContentFrame"> </FRAMESET> I'm guessing you'll want the second frame... it can be accessed with either $oFrame = _IEFrameGetObjByName($oIE, "SContentFrame") or $oFrame = _IEFrameGetObjByIndex($oIE, 1) Then use $oFrame where you would have used $oIE in the form examples... 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 Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted August 12, 2006 Moderators Share Posted August 12, 2006 I've gotten it this far, but I'm not sure how to call the OnPhoenixLogin() function. Maybe Dale can help with that. #include <IE.au3> $sUsername = "Your Username" $sPassword = "Your Password" $sURL = "http://mail.hansenet.de" $oIE = _IECreate($sURL) $oFrame = _IEFrameGetObjByName ($oIE, "SContentFrame") $oForm = _IEFormGetObjByName($oFrame, "dataentry") $oUsername = _IEFormElementGetObjByName($oForm, "username") $oPassword = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($oUsername, $sUsername) _IEFormElementSetValue($oPassword, $sPassword) Link to comment Share on other sites More sharing options...
DaleHohm Posted August 12, 2006 Share Posted August 12, 2006 There are several ways to finish this... one is to click the button image (it is inside a link with an action that executes the Javascript function): #include <IE.au3> $sUsername = "Your Username" $sPassword = "Your Password" $sURL = "http://mail.hansenet.de" $oIE = _IECreate($sURL) $oFrame = _IEFrameGetObjByName ($oIE, "SContentFrame") $oForm = _IEFormGetObjByName($oFrame, "dataentry") $oUsername = _IEFormElementGetObjByName($oForm, "username") $oPassword = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($oUsername, $sUsername) _IEFormElementSetValue($oPassword, $sPassword) _IEImgClick($oFrame, "/graphics/button_anmelden.gif") 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 Link to comment Share on other sites More sharing options...
vim Posted August 13, 2006 Share Posted August 13, 2006 I read the help file on this but not sure of "$s_name" in regards to numeric values. Does it start with "0"? Would $oFrame = _IEFrameGetObjByIndex($oIE, 0) get frame NAME=SessionFrame instead? These replays from both Dale & Big_Daddy have been a big help for me on another 'frame' site. vim Looking at the source of the page you'll see: <FRAMESET ROWS="1,1000" BORDER="0" FRAMEBORDER="0"> <FRAME SRC="/supp/blank.htm" SCROLLING="NO" NAME="SessionFrame"> <FRAME SRC="/mail/Login?domain=hansenet.de&style=default&plain=0" SCROLLING="no" NAME="SContentFrame"> </FRAMESET> I'm guessing you'll want the second frame... it can be accessed with either $oFrame = _IEFrameGetObjByName($oIE, "SContentFrame") or $oFrame = _IEFrameGetObjByIndex($oIE, 1) Then use $oFrame where you would have used $oIE in the form examples... Dale Link to comment Share on other sites More sharing options...
vim Posted August 13, 2006 Share Posted August 13, 2006 (edited) I read the help file on this but not sure of "$s_name" in regards to numeric values.Does it start with "0"? Would $oFrame = _IEFrameGetObjByIndex($oIE, 0)get frame: NAME="SessionFrame" instead?These replays from both Dale & Big_Daddy have been a big help for me on another 'frame' site.vim Edited August 13, 2006 by vim Link to comment Share on other sites More sharing options...
DaleHohm Posted August 13, 2006 Share Posted August 13, 2006 Ooops... I just can't get used to the fact that I replaced most of the *ByIndex functions with *GetCollection... I'm pretty certain that EVERY index reference in IE.au3 os zero-based, so the first is 0, the second is 1. The call for getting an indexed frame is $oFrame = _IEFrameGetCollection($oIE, 0-based-index) 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 Link to comment Share on other sites More sharing options...
Dizzy Posted August 14, 2006 Author Share Posted August 14, 2006 Hi Dale (and all others!), *** thanks *** for the help getting the right fields. Now i see how to work with the frames. Dizzy Link to comment Share on other sites More sharing options...
Dizzy Posted August 14, 2006 Author Share Posted August 14, 2006 (edited) Okay ... it isn't soooo easy I try to make a login at this site : https://www.dresdner-privat.de/On the left site you can see "Finanzstatus".I've had a look at the source - and i think it should be the frame "nav" or the page "/fb/setzkasten/entryAnonym0.html".#include <IE.au3> $sURL = "https://www.dresdner-privat.de/" $oIE = _IECreate($sURL) $oFrame = _IEFrameGetObjByName ($oIE, "nav") _IELinkClickByText ($oIE, "Finanzstatus")No function Whats wrong?Thanks for help! Edited August 14, 2006 by Dizzy Link to comment Share on other sites More sharing options...
DaleHohm Posted August 14, 2006 Share Posted August 14, 2006 @Dizzy There are actually several problems here. First, you used _IEFrameGetObjByName to get the frame reference, but then you used $oIE in the _IELinkClickByText call. Second, "nav" is not the name of the frame you want. If you are using SciTe you should see a warning at the console telling you there was noMatch for that name. It is tricky because the page is actually being generated on the fly by the Javascript at the top of the page. Using the browser's View Source, you see the Javascript code, but not the generated HTML. You can see it using IE.au3 with the following (when using SciTe): #include <IE.au3> $oIE = _IECreate("https://www.dresdner-privat.de/", 1) ConsoleWrite(_IEBodyReadHTML($oIE) & @CR)oÝ÷ ØZèØb³*.ßÙe±çëp T@0Kyø§yÚ'¶©jÛazÞÊ°j{b²«¨µºÊ«¨´Ú0Êj{¬xy'$$ÞÆÖî¶Ø^)äµìmʬ¥ç"~'Á«'ßÛjº+^®(!´b±§-¹©eÊ«¨¶Ev§ÎËZ¶ë*ºX¢çǶ¬{azÊ.Ç®±ârEæ3Ó~¨¶¦zíçèZ0xºÚ"µÍÚ[ÛYH ÒQK]LÉÝÂÌÍÛÒQHHÒQPÜX]J ][ÝÚÎËÝÝÝËÙ]]KÉ][ÝËJBÌÍÛÑ[YHHÒQQ[YQÙ]ØS[YJ ÌÍÛÒQK ][ÝØÙI][ÝÊBÌÍÛÓ[ÜÈHÒQS[ÑÙ]ÛÛXÝ[Û ÌÍÛÑ[YJBÌÍÚHHÜ ÌÍÛÓ[È[ ÌÍÛÓ[ÜÂPÛÛÛÛUÜ]J ][ÝÒ[^ ][ÝÈ [È ÌÍÚH [È ][ÝÈ[È^ ][ÝÈ [È ÌÍÛÓ[Ë[^ [ÈÔBIÌÍÚH ÏHB^ 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 Link to comment Share on other sites More sharing options...
Dizzy Posted August 15, 2006 Author Share Posted August 15, 2006 @Dale Everthing looks so easy - but i have to learn and try a little bit more. Thanks Dale - this is a great explanation for my faults. OK - the first error (_IEFrameGetObjByName ) is clear. That came by different tests and was not thought to the end. I see the Javascript and i know that this would be a problem too. But in your examples i can see as you merge scite for analysis. For $oLink in $oLinks ConsoleWrite("Index: " & $i & " Link Text: " & $oLink.innerText & @CR) $i += 1 Next I haven't known the ".innerText" function. Now i have found it in the IE.au3 - but is there a little explanation everywhere? And last - i thought that a piece of the link "Finanzstatus" should be enough? It seems i have to take the hole word including spaces and signs. Thanks again!! Link to comment Share on other sites More sharing options...
DaleHohm Posted August 15, 2006 Share Posted August 15, 2006 You're welcome. You can find information about .innerText and all other related properties etc. at MSDN. _IE_Introduction() will give you some starting points. 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 Link to comment Share on other sites More sharing options...
Dizzy Posted August 15, 2006 Author Share Posted August 15, 2006 (edited) Another one (question) ... When i use the pretty code from Dale i am on the same page as bevor - just with an different body. If i use : #include <IE.au3> $oIE = _IECreate("https://www.dresdner-privat.de/", 1) $oFrame = _IEFrameGetObjByName($oIE, "body") _IELinkClickByText ($oFrame, "> Finanzstatus") I will get the right body with the same url (https://www.dresdner-privat.de/). Now i want to list all links (like Dales example) but nothing was given out on the console .. Is the reference false? OK - next step i look for frames ... #include <IE.au3> $oIE = _IECreate("https://www.dresdner-privat.de/", 1) $oFrame = _IEFrameGetObjByName($oIE, "body") _IELinkClickByText ($oFrame, "> Finanzstatus") Sleep (2000) ConsoleWrite(_IEBodyReadHTML($oIE) & @CR) $oFrame = _IEFrameGetObjByName($oIE, "body") $oLinks = _IELinkGetCollection($oFrame) $i = 0 For $oLink in $oLinks ConsoleWrite("Index: " & $i & " Link Text: " & $oLink.innerText & @CR) $i += 1 Next $oFrames = _IEFrameGetCollection ($oIE) $iNumFrames = @extended For $i = 0 to ($iNumFrames - 1) $oFrame = _IEFrameGetCollection ($oIE, $i) ConsoleWrite(_IEPropertyGet ($oFrame, "locationurl") & @CR) Next I get following in the console : <FRAME id=header name=header marginWidth=0 marginHeight=0 src="/servlet/P/getHeader.do" frameBorder=0 noResize scrolling=no><FRAME id=body name=body marginWidth=0 marginHeight=0 src="/fb/setzkasten/entryAnonym0.html" frameBorder=0 noResize> https://www.dresdner-privat.de/servlet/P/getHeader.do https://www.dresdner-privat.de/servlet/P/fo...tus_anzeigen.do I just want to get the fields or names to logon ... Sure - i can direct jump to the site using the second url and skip with a "tab" from field to field - but i want to understand the other way. :"> Grummmel ... shit ... hmmm ???? Dale?? Edited August 15, 2006 by Dizzy Link to comment Share on other sites More sharing options...
DaleHohm Posted August 15, 2006 Share Posted August 15, 2006 You need to dig down yet again. The body frame gets rewritten such that it now contans frames... you need to open the frame named "content" in the frame named "body" and your form and form fields live in there... 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 Link to comment Share on other sites More sharing options...
Dizzy Posted August 16, 2006 Author Share Posted August 16, 2006 (edited) @DaleOk - it's going on With your hints i'm able to use this code:expandcollapse popup#include <IE.au3> $sUsername = "MyName" $sPassword = "Pass" $oIE = _IECreate("https://www.dresdner-privat.de/", 1) $oFrame = _IEFrameGetObjByName($oIE, "body") _IELinkClickByText ($oFrame, "> Finanzstatus") ;*** START : only for analysis *** ;ConsoleWrite(_IEBodyReadHTML($oIE) & @CR) ;*** END : only for analysis *** $oFrame1 = _IEFrameGetObjByName ($oIE, "body") $oFrame2 = _IEFrameGetObjByName ($oFrame1, "content") ;*** START : only for analysis *** ;$oForms = _IEFormGetCollection ($oFrame2) ;For $oForm In $oForms ; ConsoleWrite("This Form is living in my box =" & $oForm.name & @CR) ;Next ;*** END : only for analysis *** $oForm = _IEFormGetObjByName($oFrame2, "loginForm") ;*** START : only for analysis *** ;$oQuery = _IEFormElementGetCollection ($oForm, -1) ;For $oQuery1 In $oQuery ; ConsoleWrite("This are my fields =" & $oQuery1.name & @CR) ;Next ;*** END : only for analysis *** $oUsername = _IEFormElementGetObjByName($oForm, "identifier") $oPassword = _IEFormElementGetObjByName($oForm, "RQRVYT2TWXPW2XTaedWTVYWVPT00VRNW") _IEFormElementSetValue($oUsername, $sUsername) _IEFormElementSetValue($oPassword, $sPassword) _IEFormImageClick ($oForm, "anmelden", "alt")Ooops they are changing the passwords elementsname ...; *** Get name of index 2 (password) $oQuery = _IEFormElementGetCollection ($oForm, 1) ;ConsoleWrite("This are my fields =" & $oQuery.name & @CR) $oUsername = _IEFormElementGetObjByName($oForm, "identifier") $oPassword = _IEFormElementGetObjByName($oForm, $oQuery.name) _IEFormElementSetValue($oUsername, $sUsername) _IEFormElementSetValue($oPassword, $sPassword) _IEFormImageClick ($oForm, "anmelden", "alt")It does what i need! (Yes .. )Is there something (without the analysis stuff) i can make easier? Perhaps the pointing of the 2 frames (body/content)?And i get one warning from scite "--> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch"starting with the site "$oIE = _IECreate("https://www.dresdner-privat.de/", 1)"Why?Is it the https?Thanks Edited August 16, 2006 by Dizzy Link to comment Share on other sites More sharing options...
DaleHohm Posted August 16, 2006 Share Posted August 16, 2006 @DaleOk - it's going on Good jobIs there something (without the analysis stuff) i can make easier?$oFrame and $oFrame1 are identical - you don't need both$oQuery and $oPassword are identical, no need to do the second one and go to that extra work.And i get one warning from scite "--> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch"starting with the site "$oIE = _IECreate("https://www.dresdner-privat.de/", 1)"Why?Notice it is a warning not an error. If you remove the " ,1" that says "try attach" it will disappear.Otherwise it looks good.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 Link to comment Share on other sites More sharing options...
Dizzy Posted August 23, 2006 Author Share Posted August 23, 2006 Good job $oFrame and $oFrame1 are identical - you don't need both $oQuery and $oPassword are identical, no need to do the second one and go to that extra work. Notice it is a warning not an error. If you remove the " ,1" that says "try attach" it will disappear. Otherwise it looks good. Dale Hmm - you're right with $oFrame and $oFrame1 - i've not seen the double. But the second one?? This one is ok : $oPassword = _IEFormElementGetCollection ($oForm, 1) But how to change the second one $oPassword = _IEFormElementGetObjByName($oForm, $oQuery.name) to use it 'cause the name is changing? Greets Dizzy Link to comment Share on other sites More sharing options...
DaleHohm Posted August 23, 2006 Share Posted August 23, 2006 This one is ok : $oPassword = _IEFormElementGetCollection ($oForm, 1) But how to change the second one $oPassword = _IEFormElementGetObjByName($oForm, $oQuery.name) to use it 'cause the name is changing? _IEFormElementGetCollection ($oForm, 1) will give you a reference to the second form element regardless of what its name is... 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now