Jump to content
Sign in to follow this  
horstj

IE Submit

Recommended Posts

horstj

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?

Share this post


Link to post
Share on other sites
jdelaney

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.

Share this post


Link to post
Share on other sites
horstj

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.

Share this post


Link to post
Share on other sites
jdelaney

$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.

Share this post


Link to post
Share on other sites
horstj

jdelaney, the change to checking by ID was all it took! Thanks for the solution.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×