afidegnum Posted March 30, 2011 Posted March 30, 2011 HI All, Everything started well till I am getting a broken heart. it start with this script doing wonderfully well until it started giving me a different part of the story. I supposed to open a page, login, navigate to few urls, expandcollapse popup#include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "maggot" Local $sPass = "mangosuite" Local $url = "http://www.imtalk.org" Local $oIE = _IECreate($url, 1, 1, 0) Local $selected = "" Local $sLinks Local $oLinks Local $sMyString _IELoadWait($oIE) Local $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "vb_login_username" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "vb_login_password" Then $oPass = $oInput if $oInput.type = "image" And $oInput.value = "Log in" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE) Sleep(500) ; _IENavigate ($oIE, "http://www.imtalk.org/cmps_index.php?pageid=IMT-Directory-Submitter",1) _IENavigate ($oIE, "http://www.imtalk.org/modules/submitter/index.php?menu=submitter&fcaptcha=0&fpr=desc", 1) $oFrame = _IEGetObjByName($oIE, "left") $sMyString = "No Captcha, PR Desc.(714)" _IELinkClickByText($oFrame, $oIE, $sMyString) $oLinks = _IELinkGetCollection($oIE) For $oLink in $oLinks $sLinkText = _IEPropertyGet($oLink, "innerText") If StringInStr($sLinkText, $sMyString) Then _IEAction($oLink, "click") ExitLoop EndIf NextI started having problem in the link clicking part. I started with trying to get the link from the $oFrame = _IEGetObjByName($oIE, "left")so I can click inside that object; it proven unsuccessfull. next I tried navigating the page to a new page. with this url _IENavigate ($oIE, "http://www.imtalk.org/modules/submitter/index.php?menu=submitter&fcaptcha=0&fpr=desc", 1)This leave out the frame in which it was located I still tried to navigate the link using the _IELinkClickByText($oFrame, $oIE, $sMyString)it also proven unsuccessful. next I used the final method to loop and match the text link, it also still did not work. i used the strinRegExp and StrinInstr both seems not working, earlier, I also tried to select and post a form but unfortunately, teh form doesn't have a name I didn't know how to select and post the selected element. I will be grateful if you can please give a hand.
Moderators big_daddy Posted April 6, 2011 Moderators Posted April 6, 2011 This seems to work. #AutoIt3Wrapper_UseX64 = n #include <IE.au3> Global $sUser = "", $sPass = "" Global $sURL = "http://www.imtalk.org" _IEErrorHandlerRegister() Global $oIE = _IECreate($sURL, 0, 1) $oForm = _IEFormGetCollection($oIE, 0) $oUser = _IEFormElementGetObjByName($oForm, "vb_login_username") $oPass = _IEFormElementGetObjByName($oForm, "vb_login_password") _IEFormElementSetValue($oUser, $sUser) _IEFormElementSetValue($oPass, $sPass) _IEFormImageClick($oForm, "http://www.imtalk.org/images/styles/FunkyFresh/style/loginButton.gif") _IENavigate($oIE, "http://www.imtalk.org/cmps_index.php?pageid=IMT-Directory-Submitter") $oFrame = _IEFrameGetCollection($oIE, 4) _IELoadWait($oFrame) _IENavigate($oFrame, "http://www.imtalk.org/modules/submitter/index.php?menu=submitter&fcaptcha=0&fpr=desc")
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