9tailsfox Posted July 2, 2019 Share Posted July 2, 2019 (edited) Hi to all expert, I need to create an automation login a website with the given username and password. After login I need to automate some task in there and then logout and then login other username and password with complete the task until the list in excel is over. How do I create an automation with the loop login username & password while complete the task aswell. I know there might be other thread but I hope I can get the answer or redirect me to the right place. thank you expandcollapse popup; Create a browser window and navigate to Australia Post $oIE = _IECreate("https://mylocalsample.com/login/") $hwndIE = _IEPropertyGet ($oIE, "hwnd") WinSetState($hwndIE, "", @SW_MAXIMIZE) ; get pointers to the login form and username, password and signin fields Local $o_form = _IEFormGetObjByName($oIE, "mblogin") Local $o_login = _IEFormElementGetObjByName($o_form, "userid") Local $o_password = _IEFormElementGetObjByName($o_form, "password") Local $username = "Paul" Local $password = "ps4123" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) ;_Submit login _IEFormSubmit($o_form) ;Click the Manifest Link _IENavigate($oIE, "https://mylocalsample.com/login/generateManifest/") Sleep(1000) ; ; ;Select Manifest BRISBANE Local $o_manifest = _IEGetObjByID($oIE, "manifest") _IEAction($o_manifest, "focus") _IEAction($o_manifest, "selectall") ClipPut ("Direct Entry Australia") _IEAction($o_manifest, "paste") ;_IEAction($o_manifestStartDate, "focus")Minus 30Days Local $o_manifestStartDate = _IEGetObjByID($oIE, "manifestStartDate") Local $oAppl = _Excel_Open() Local $oMyDocDir = @MyDocumentsDir & "\Date.xlsx" If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error Copy Date" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open Workbook 1 Local $oWorkbook1 = _Excel_BookOpen($oAppl, $oMyDocDir, True) Local $oRange = $oWorkbook1.ActiveSheet.Range("A4") _Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange) ;paste it to program like notepad, wordpad, DMS, or msword ;WinActivate("New Zealand Post - Customs Manifests - Internet Explorer", "") _IEAction($o_manifestStartDate, "focus") _IEAction($o_manifest, "selectall") _IEAction($o_manifestStartDate, "paste") ;_IEAction($o_manifestEndDate, "focus")Today Local $o_manifestEndDate = _IEGetObjByID($oIE, "manifestEndDate") _IEAction($o_manifestEndDate, "focus") Sleep(1000) Local $o_manifestPort = _IEGetObjByID($oIE, "manifestPort") _IEAction($o_manifestPort, "focus") _IEAction($o_manifestPort, "selectall") ClipPut ("Brisbane") _IEAction($o_manifestPort, "paste") Local $o_selectedManifestDate = _IEGetObjByID($oIE, "selectedManifestDate") _IEAction($o_selectedManifestDate, "focus") Sleep(1000) Local $o_ConfirmManifest = _IEGetObjByID($oIE, "generateManifestButton") _IEAction($o_ConfirmManifest, "focus") _IEAction($o_ConfirmManifest, "click") Sleep(1000) Local $o_LodgementRef = _IEGetObjByID($oIE, "lodgementRef") _IEAction($o_LodgementRef, "focus") ClipPut ("BNE") _IEAction($o_LodgementRef, "paste") Local $o_ContinueM = _IEGetObjByID($oIE, "dijit_form_Button_0_label") ; dijit_form_Button_1_label cancel _IEAction($o_ContinueM, "click") sleep(1000) ; ; ; ;Logout _IENavigate($oIE, "https://mylocalsample.com/login/?logout") Sleep(1000) Local $o_form = _IEFormGetObjByName($oIE, "mblogin") Local $o_login = _IEFormElementGetObjByName($o_form, "userid") Local $o_password = _IEFormElementGetObjByName($o_form, "password") Local $username = "Raymond" Local $password = "Overigh23" ; Set field values and submit the form _IEFormElementSetValue($o_login, $username) _IEFormElementSetValue($o_password, $password) ;_Submit login _IEFormSubmit($o_form) ;Click the Manifest Link _IENavigate($oIE, "https://mylocalsample.com/login/generateManifest/") Sleep(1000) ; ; ;Select Manifest BRISBANE Local $o_manifest = _IEGetObjByID($oIE, "manifest") _IEAction($o_manifest, "focus") _IEAction($o_manifest, "selectall") ClipPut ("Direct Entry Australia") _IEAction($o_manifest, "paste") ;_IEAction($o_manifestStartDate, "focus")Minus 30Days Local $o_manifestStartDate = _IEGetObjByID($oIE, "manifestStartDate") Local $oAppl = _Excel_Open() Local $oMyDocDir = @MyDocumentsDir & "\Date.xlsx" If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeCopy Example", "Error Copy Date" & @CRLF & "@error = " & @error & ", @extended = " & @extended) ; Open Workbook 1 Local $oWorkbook1 = _Excel_BookOpen($oAppl, $oMyDocDir, True) Local $oRange = $oWorkbook1.ActiveSheet.Range("A4") _Excel_RangeCopyPaste($oWorkbook1.ActiveSheet, $oRange) ;paste it to program like notepad, wordpad, DMS, or msword ;WinActivate("New Zealand Post - Customs Manifests - Internet Explorer", "") _IEAction($o_manifestStartDate, "focus") _IEAction($o_manifest, "selectall") _IEAction($o_manifestStartDate, "paste") ;_IEAction($o_manifestEndDate, "focus")Today Local $o_manifestEndDate = _IEGetObjByID($oIE, "manifestEndDate") _IEAction($o_manifestEndDate, "focus") Sleep(1000) Local $o_manifestPort = _IEGetObjByID($oIE, "manifestPort") _IEAction($o_manifestPort, "focus") _IEAction($o_manifestPort, "selectall") ClipPut ("Brisbane") _IEAction($o_manifestPort, "paste") Local $o_selectedManifestDate = _IEGetObjByID($oIE, "selectedManifestDate") _IEAction($o_selectedManifestDate, "focus") Sleep(1000) Local $o_ConfirmManifest = _IEGetObjByID($oIE, "generateManifestButton") _IEAction($o_ConfirmManifest, "focus") _IEAction($o_ConfirmManifest, "click") Sleep(1000) Local $o_LodgementRef = _IEGetObjByID($oIE, "lodgementRef") _IEAction($o_LodgementRef, "focus") ClipPut ("BNE") _IEAction($o_LodgementRef, "paste") Local $o_ContinueM = _IEGetObjByID($oIE, "dijit_form_Button_0_label") ; dijit_form_Button_1_label cancel _IEAction($o_ContinueM, "click") sleep(1000) ; ;Logout _IENavigate($oIE, "https://mylocalsample.com/login/?logout") Sleep(1000) ; Spoiler Spoiler Edited July 2, 2019 by 9tailsfox Revised Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 2, 2019 Share Posted July 2, 2019 @9tailsfox Take a look at Excel UDF and IE UDF on the forums/in the Help file. There are plenty threads (and in the Help file too) where these arguments are discussed Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
9tailsfox Posted July 2, 2019 Author Share Posted July 2, 2019 Thank you Francesco :-) Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 2, 2019 Share Posted July 2, 2019 @9tailsfox You're welcome. If you need more assistance on what you're doing, don't be afraid to ask, and always try to post your script so we can help you from what you've done Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
9tailsfox Posted July 2, 2019 Author Share Posted July 2, 2019 Yes, I will. As you can see I just created very simple script but If it able to read the username and password in the excel column. In the future I just need to update the Excel list not the au3 script. Thank you :-) Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 2, 2019 Moderators Share Posted July 2, 2019 Also, as a friendly reminder, please ensure you've read and are adhering to the forum rules when it comes to website automation. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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