horstj Posted January 25, 2013 Share Posted January 25, 2013 Hi All, This is probably a very easy problem/solution, but I have some code that I cannot get to work no matter what I try. All I want to do is pull up IE, enter some login credentials, and submit the form. Everything works fine, but I cannot get anything to actually do the submitting. Here is the code I have: Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe -new https://login.salesforce.com/","") $sfWinHwnd = WinWaitActive("[CLASS:IEFrame]") WinWaitActive("salesforce.com - Customer Secure Login Page - Windows Internet Explorer") $sfIE = _IEAttach($sfWinHwnd,"HWND") $sftxtName = _IEGetObjByName($sfIE,"username") $sftxtPassword = _IEGetObjByName($sfIE,"pw") $sfForm = _IEFormGetObjByName($sfIE,"login") $sfLogin = _IEFormGetObjByName($sfForm,"Login") _IEFormElementSetValue($sftxtName,"asdf") _IEFormElementSetValue($sftxtPassword,"asdf") _IEAction($sfLogin,"click") And here is the code for the login button in the page's source: <input class="loginButton" type="submit" id="Login" name="Login" value="Login" /> Does anyone know how I can get this to work? Link to comment Share on other sites More sharing options...
GMK Posted January 25, 2013 Share Posted January 25, 2013 Did you try _IEFormSubmit? Link to comment Share on other sites More sharing options...
jdelaney Posted January 25, 2013 Share Posted January 25, 2013 Are you able to find the objects? Do some error handling the be sure: If Not IsObj($yourvariable) Then sometimes, it helps to do _IEAction($yourvariable, 'focus'), prior to the click. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
horstj Posted January 25, 2013 Author Share Posted January 25, 2013 GMK, I did try form submit, but that didn't work either. jdelaney, I tried both of your suggestions and neither one seemed to work. The "if not" code did not kick off my messagebox so I took the "not" away and the box popped up. Thanks for your help. Link to comment Share on other sites More sharing options...
jdelaney Posted January 25, 2013 Share Posted January 25, 2013 $sfLogin = _IEGetObjById($sfIE,"Login") use the above to get the button...probably multiple name = login IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Bert Posted January 25, 2013 Share Posted January 25, 2013 I sent a PM to the OP on how to use the URL sting to do it. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
horstj Posted January 25, 2013 Author Share Posted January 25, 2013 jdelaney, the change to checking by ID was all it took! Thanks for the solution. 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