sc4ry Posted September 4, 2008 Share Posted September 4, 2008 (edited) Hi, i need help by checking html code, to find the correct objects to send my login-data to this site. i also have another script which works very fine for another site: $oIE2 = _IECreate("http://www.google.de/", 0, 0, 1, -1) $oHWND2 = _IEPropertyGet($oIE2, "hwnd") $LocationURL2 = _IEPropertyGet($oIE2, "locationurl") If $LocationURL2 = "https://proxy.de.group.net/?dest=http://www.google.de/" Then $oForm = _IEFormGetCollection($oIE2, 0) $oUsername = _IEFormElementGetObjByName($oForm, "user") $oPassword = _IEFormElementGetObjByName($oForm, "pass") _IEFormElementSetValue($oUsername, $ieuser) _IEFormElementSetValue($oPassword, $iepw) _IEFormSubmit($oForm, 0) Endif i think enclose must be the correct part of the whole code, which should show me the objects to input user, password and to submit, or? which objects i now have to input for "user" and "pass" in the script above? thank you for your help. <span ct="TV" class="urTxtEmph" style="white-space:nowrap;"white-space:nowrap;>Corporate User-ID</span> </td> </tr> <tr> <td> <span id="htmlb_341292_htmlb_286522_1-r" class="urEdf2Whl"><input type="Text" class="urEdf2TxtEnbl" autocomplete="off" maxlength="100" id="htmlb_341292_htmlb_286522_1" ct="I" name="htmlb_341292_htmlb_286522_1" st="" tp="STRING" value="" onchange="sapUrMapi_InputField_change('htmlb_341292_htmlb_286522_1',event);" onblur="sapUrMapi_InputField_Blur('htmlb_341292_htmlb_286522_1',event);" onkeydown="sapUrMapi_InputField_keydown('htmlb_341292_htmlb_286522_1',event);" onkeyup="sapUrMapi_InputField_KeyUp('htmlb_341292_htmlb_286522_1',event);" onfocus="sapUrMapi_InputField_focus('htmlb_341292_htmlb_286522_1',event);" onselectstart="sapUrMapi_InputField_onselectstart('htmlb_341292_htmlb_286522_1',event);" ></span> </td> </tr> <tr> <td> <span ct="TV" class="urTxtEmph" style="white-space:nowrap;"white-space:nowrap;>Passwort</span> </td> </tr> <tr> <td> <span id="htmlb_341292_htmlb_286522_2-r" class="urEdf2Whl"><input type="Password" class="urEdf2TxtEnbl" autocomplete="off" maxlength="100" id="htmlb_341292_htmlb_286522_2" ct="I" name="htmlb_341292_htmlb_286522_2" st="" tp="PW" value="" onchange="sapUrMapi_InputField_change('htmlb_341292_htmlb_286522_2',event);" onblur="sapUrMapi_InputField_Blur('htmlb_341292_htmlb_286522_2',event);" onkeydown="sapUrMapi_InputField_keydown('htmlb_341292_htmlb_286522_2',event);" onkeyup="sapUrMapi_InputField_KeyUp('htmlb_341292_htmlb_286522_2',event);" onfocus="sapUrMapi_InputField_focus('htmlb_341292_htmlb_286522_2',event);" onselectstart="sapUrMapi_InputField_onselectstart('htmlb_341292_htmlb_286522_2',event);" ></span> </td> </tr> <tr> <td> <a id="htmlb_341292_htmlb_286522_3" ct="B" st="" href="java script:void(0);" class="urBtnStd" ocl="if (htmlbButton_checkClick('htmlb_341292_htmlb_286522_3', event)) {return htmlbDoEvent(this,'X','onclick','0','htmlb_341292_htmlb_286522',3,1,'',0);}" onkeydown="return ur_Button_keypress(event)" onclick="return ur_Button_click(event);" >Anmelden</a> Edited September 4, 2008 by sc4ry Link to comment Share on other sites More sharing options...
jokke Posted September 4, 2008 Share Posted September 4, 2008 (edited) you can get the element by index value or by element name (element name is recomended, incase site changes) Passowrd fields element name = "htmlb_341292_htmlb_286522_2" Username fields element name = "htmlb_341292_htmlb_286522_1" Edited September 4, 2008 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
sc4ry Posted September 4, 2008 Author Share Posted September 4, 2008 Hi jokka, thanks for help. i tried this, but it does not work (maybe i have to change something in my code?) this is now the script to login with errors and warnings: #include <IE.au3> $oIE2 = _IECreate("portal", 0, 1, 1, -1) $oHWND2 = _IEPropertyGet($oIE2, "hwnd") $oForm = _IEFormGetCollection($oIE2, 0) $oUsername = _IEFormElementGetObjByName($oForm, "htmlb_341292_htmlb_286522_1") $oPassword = _IEFormElementGetObjByName($oForm, "htmlb_341292_htmlb_286522_2") _IEFormElementSetValue($oUsername, "testuser") _IEFormElementSetValue($oPassword, "testpw") _IEFormSubmit($oForm, 0) --> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch --> IE.au3 V2.4-0 Warning from function _IEFormElementGetObjByName, $_IEStatus_NoMatch --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType Link to comment Share on other sites More sharing options...
jokke Posted September 4, 2008 Share Posted September 4, 2008 The controlls are they dynamic or anything like that? They had a very weird name. Try to fetch them by index, may work better inn this case. UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
jokke Posted September 4, 2008 Share Posted September 4, 2008 Btw are there multiple forms on the page? You may have tried to attach to the wrong form. UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
sc4ry Posted September 4, 2008 Author Share Posted September 4, 2008 oh yes, that might be the problem. how can i get the index? Link to comment Share on other sites More sharing options...
jokke Posted September 4, 2008 Share Posted September 4, 2008 (edited) from help example: #include <IE.au3> $oIE = _IECreate ("http://www.autoitscript.com") $oForms = _IEFormGetCollection ($oIE) MsgBox(0, "Forms Info", "There are " & @extended & " forms on this page") For $oForm In $oForms MsgBox(0, "Form Info", $oForm.name) Next Edited September 4, 2008 by jokke UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
sc4ry Posted September 4, 2008 Author Share Posted September 4, 2008 Hey, thank you, thats great. i was shocked because there is only 1 form on this site ... but with your script i get the dynamic form-name and user and pw is this form name wirh _1 and _2. so this works: $oUsername = _IEFormElementGetObjByName($oForm, $oForm.name & "_1") $oPassword = _IEFormElementGetObjByName($oForm, $oForm.name & "_2") now there seems only a prob with submitting, but i will try on my own first =) big thanks =) Link to comment Share on other sites More sharing options...
sc4ry Posted September 4, 2008 Author Share Posted September 4, 2008 hmm, submit does not work. the page will reload, but user ist not logged in ... i try ControlSend($oIE2, "", $oForm, "{Enter}") this works, but is it a good alternative? but now i have another question. ist that also possible with programms? i want to create an automatic sap-login. user an pw-field does not have an own handle (in autoitinfo). controlsend does not work correctly. do i have an alternative? Link to comment Share on other sites More sharing options...
jokke Posted September 4, 2008 Share Posted September 4, 2008 If the script intention is to run inn the foreground thats a useable method. I would recomend to find a workaround thogh where you use a _IE function. try with a None Index, Index value -1 or something like that. Been some time since i used the _IE functions. UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt. Link to comment Share on other sites More sharing options...
sc4ry Posted September 4, 2008 Author Share Posted September 4, 2008 ok, i found 2 things, but don´t know how to use =) if i see the properties of the "logon" button i can see this: java script:void(0); or the index of the button: $oForm.name & "_3" 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