faustf Posted August 16, 2016 Share Posted August 16, 2016 (edited) hi guy , i have a little problem with automation a page web of this shipment-site www.spediamo.it i have created this scritp , and it work good but when arrive at flag a checkbox not work expandcollapse popup; Script Start - Add your code below here #include <IE.au3> #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <InetConstants.au3> #include <WinAPI.au3> #include <WinAPIsysinfoConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <Misc.au3> #include <INet.au3> #include <Excel.au3> #include <File.au3> #include <Array.au3> _Spediamo_it_WEB() Func _Spediamo_it_WEB() If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running. ProcessClose("iexplore.exe") EndIf Global $oIE = _IECreate("http://www.spediamo.it/", 0, 1, 1, 1) ; <--- 0011 invisible explorer <--- 0111 visible explorer _IELoadWait($oIE) Local $oForm = _IEGetObjByName($oIE, "loginform") Local $oUsername = _IEFormElementGetObjByName($oForm, "username") _IEFormElementSetValue($oUsername, "faust@yopmail.com") Local $pass = _IEFormElementGetObjByName($oForm, "password") _IEFormElementSetValue($pass, "kronos@123") Local $oBotton_SingIn = _IEGetObjById($oIE, "click_for_login") _IEAction($oBotton_SingIn, "Click") _IELoadWait($oIE) Sleep(3000) Local $oDiv = _IEGetObjById($oIE, "add_new_shipment") _IEAction($oDiv, "focus") _IEAction($oDiv, "Click") _IELoadWait($oIE) ;---------- SPEDIZIONI ----------------------------------------------------------- Local $oColli = _IEGetObjByName($oIE, "SHIPMENT::collection_date") _IEAction($oColli, "focus") _IEAction($oColli, "Click") _IEFormElementSetValue($oColli, "17/08/2016") Sleep(2000) Local $oColli = _IEGetObjByName($oIE, "1::0::BOX::number") _IEAction($oColli, "focus") _IEAction($oColli, "Click") _IEFormElementSetValue($oColli, "1") Local $oPeso = _IEGetObjByName($oIE, "1::0::BOX::weigth") _IEAction($oPeso, "focus") _IEAction($oPeso, "Click") _IEFormElementSetValue($oPeso, "10") Local $oAltezza = _IEGetObjByName($oIE, "1::0::BOX::height") _IEAction($oAltezza, "focus") _IEAction($oAltezza, "Click") _IEFormElementSetValue($oAltezza, "15") Local $oLargezza = _IEGetObjByName($oIE, "1::0::BOX::length") _IEAction($oLargezza, "focus") _IEAction($oLargezza, "Click") _IEFormElementSetValue($oLargezza, "17") Local $oProfondita = _IEGetObjByName($oIE, "1::0::BOX::depth") _IEAction($oProfondita, "focus") _IEAction($oProfondita, "Click") _IEFormElementSetValue($oProfondita, "19") Local $o1Step = _IEGetObjById($oIE, "btn-confirm-main-form") _IEAction($o1Step, "focus") _IEAction($o1Step, "Click") _IELoadWait($oIE) ;------------------------------------------------------------------------------------- ;--------- RITIRA PRESSO ------------------------------------------------------------- Local $oCognomeMIT = _IEGetObjByName($oIE, "SENDER::name") _IEAction($oCognomeMIT, "focus") _IEAction($oCognomeMIT, "Click") _IEFormElementSetValue($oCognomeMIT, "lopresti armando") Local $oProvinciaMIT = _IEGetObjByName($oIE, "SENDER::province") _IEAction($oProvinciaMIT, "focus") _IEFormElementOptionSelect($oProvinciaMIT, "FI - Firenze", 1, "byText") Sleep(3000) Local $oCittaMIT = _IEGetObjByName($oIE, "SENDER::town") _IEAction($oCittaMIT, "focus") _IEFormElementOptionSelect($oCittaMIT, "Fucecchio", 1, "byText") #cs Sleep(3000) Local $oCapMIT = _IEGetObjByName($oIE, "SENDER::postalCode") _IEAction($oCapMIT, "focus") _IEFormElementOptionSelect($oCapMIT, "50054", 1, "byText") #ce Local $oIndirizzoMIT = _IEGetObjByName($oIE, "SENDER::address") _IEAction($oIndirizzoMIT, "focus") _IEAction($oIndirizzoMIT, "Click") _IEFormElementSetValue($oIndirizzoMIT, "via tal dei tali") Local $oNominativoMIT = _IEGetObjByName($oIE, "SENDER::contactName") _IEAction($oNominativoMIT, "focus") _IEAction($oNominativoMIT, "Click") _IEFormElementSetValue($oNominativoMIT, "armando") Local $oCellulareMIT = _IEGetObjByName($oIE, "SENDER::mobile") _IEAction($oCellulareMIT, "focus") _IEAction($oCellulareMIT, "Click") _IEFormElementSetValue($oCellulareMIT, "33326363563") Local $oTriangola = _IEGetObjByName($oIE, "billing_address_in_waybill") Local $cosa = _IEFormElementCheckBoxSelect($oTriangola, 0, "billing_address_in_waybill", 1, "byIndex") Local $o1Step = _IEGetObjById($oIE, "btn-confirm-main-form") _IEAction($o1Step, "focus") _IEAction($o1Step, "Click") _IELoadWait($oIE) Sleep(3000) ;------------------------------------------------------------------------------------- ;---- CONDSEGNA A -------------------------------------------------------------------- ;------------------------------------------------------------------------------------- EndFunc ;==>_Spediamo_it_WEB the checkbox is billing_address_in_waybill anyone have some suggestions??? thankz alot Edited August 16, 2016 by faustf Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 Hello $oTriangola should be the form object where is the checkbox. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 sorry i dont understund Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 Consider share part of the HTML. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 you can see directly by web the user and password work, go in www.spediamo.it and use for login faust@yopmail.com kronos@123 please dont create shipment Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 Don't share credentials :S Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 yea usally dont share but this site is very particular , and i dont know how copy a html , for example , after the problem of checkbox i have another problem , when arrive at confirm a shipment the site create on the fly a page , but i can only see with inspect element , in pagesource dont exist the html , i think bcause it create with javascript on the fly Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 I think something like this should work. Local $oTriangola = _IEGetObjByName($oIE, "form_order") Local $cosa = _IEFormElementCheckBoxSelect($oTriangola, 0, "billing_address_in_waybill", 1, "byIndex") Saludos faustf 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 genius another questions , when finish the script , and i create a shipment , (i must confirm) ,i dont know , what way i must use , because the checkbox for confirm the ship is create at fly and assign at it a id=2317563 (numbre is random ) how is possible to flag it? i try to read with this Local $sText = _IEBodyReadHTML($oIE) ConsoleWrite($sText) but in result not have the id and all line of shipment and tryed with this Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended Local $sTxt = $iNumLinks & " links found" & @CRLF & @CRLF For $oLink In $oLinks $sTxt &= $oLink.id & @CRLF Next ConsoleWrite("Link Info " & $sTxt) but not work not find a shipment could help me??? yhankz again Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 (edited) Probably I need to create a shipment to see that value. I think I create one but deleted it sorry :S Saludos Edited August 16, 2016 by Danyfirex Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 (edited) yea dont worry you can create if happenn somthing wrong dont worry i comunicate with the staff of site and erase it Edited August 16, 2016 by faustf Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 send a screenshort of the windows you're trying to handle. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 you have email i send by mail because have limit at 10 k and if i reduce not see nothing Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 Use extern image storage server like imgur. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 ok thankz Link to comment Share on other sites More sharing options...
Danyfirex Posted August 16, 2016 Share Posted August 16, 2016 Probably you can do somthing like this using the Object Class Name. Local $oFirstCheckBox = _IEGetObjByClass($oIE, "selectable") If IsObj($oFirstCheckBox) Then $oFirstCheckBox.checked = True EndIf Func _IEGetObjByClass(ByRef $o_object, $s_Class, $i_index = 0) If Not IsObj($o_object) Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidDataType") SetError($_IEStatus_InvalidDataType, 1) Return 0 EndIf ; If Not __IEIsObjType($o_object, "browserdom") Then __IEConsoleWriteError("Error", "_IEGetObjByClass", "$_IEStatus_InvalidObjectType") SetError($_IEStatus_InvalidObjectType, 1) Return 0 EndIf ; Local $i_found = 0 ; $o_tags = _IETagNameAllGetCollection($o_object) For $o_tag In $o_tags If String($o_tag.className) = $s_Class Then If ($i_found = $i_index) Then SetError($_IEStatus_Success) Return $o_tag Else $i_found += 1 EndIf EndIf Next ; __IEConsoleWriteError("Warning", "_IEGetObjByClass", "$_IEStatus_NoMatch", $s_Class) SetError($_IEStatus_NoMatch, 2) Return 0 EndFunc ;==>_IEGetObjByClass That code just select the first one Checkbox. To handle all checkboxs of the list you can get a collection of the selectable object. of probably get the max selectable object index (Simple way could be getting doc html and use maybe stringreplace to count how many selectable object exist. then use _IEGetObjByClass with the correct object index to check/uncheck. I also think you can use _IETableGetCollection to get the table then check inside the table and get the checkbox objects. Saludos faustf 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 yessss big geniussss thankz so much Bro you win a beer Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 mm somtime work sometime not work o_O i have this error __IEConsoleWriteError undefine function Link to comment Share on other sites More sharing options...
anthonyjr2 Posted August 16, 2016 Share Posted August 16, 2016 19 minutes ago, faustf said: mm somtime work sometime not work o_O i have this error __IEConsoleWriteError undefine function That means the function doesn't exist. I may be wrong but I can't find "__IEConsoleWriteError" anywhere in the IE Function UDF documentation. UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
faustf Posted August 16, 2016 Author Share Posted August 16, 2016 i find a solution is latency of browser introduce some pause 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