Jump to content
Sign in to follow this  
MidwayMonster

IE.au3 Form issue

Recommended Posts

MidwayMonster

Let me appologize in advance - I am actually having just as hard of a time explaining this issue as i am trying to resolve the issue :

I am trying to automate a SAP licensing site the normal text baxed fields of the form are just fine but there are a few drop down boxes. Once you select the option it updates the rest of the form with the updated options.

The closest i can get (below code) puts in the proper entries into each drop down but the form doesnt execute / update. I also put that form items website code below as well (obtained from debug bar).

WinActivate("License Key Request")

$oTSystemForm2 = _IEFormGetCollection ($oTLoginIE, 0)
; Text based item - works just fine
$oTSysName = _IEFormElementGetObjByName ($oTSystemForm2, "ff_system_name")
_IEFormElementSetValue ($oTSysName, $IeStore)
Sleep(2000)

; Drop down item - issue with this element - Production Support is the item value
$oTSysType = _IEFormElementGetObjByName ($oTSystemForm2, "ff_system_type")
_IEFormElementSetValue ($oTSystype, "Production support", 1)

I have also experimented with:

_IEFormElementOptionselect ($oTSysType, "Production support", 1, "byValue")

_IEFormElementOptionselect ($oTSysType, 5, 1, "byIndex") ; Production support is the 6th item in the list

Here is the code from the website:

<INPUT onblur="sapUrMapi_ComboBox_blurDdlb('ff_system_type',event);" style="WIDTH: 300px" onkeydown="sapUrMapi_ComboBox_keydown('ff_system_type',event);" id=ff_system_type onselectstart=sapUrMapi_cancelEvent(event); class=urCoB2TxtDdl onfocus="sapUrMapi_ComboBox_focusDdlb('ff_system_type',event);" tabIndex=0 onkeypress="sapUrMapi_ComboBox_keypress('ff_system_type',event);" readOnly value="Please select" ct="ComboBox" ti="0" vs="Please select" ic="8" dd="true" vt="true" st="" op="false" lid="ff_system_type-lb" ks="" k="">

Also one more entry for it:

<INPUT id=ff_system_typeKey name=ff_system_type type=hidden>


Keith Hugginswww.LivingViLife.com | [email="Keith.Visalus@gmail.com"]Keith.Visalus@gmail.com[/email]Want to automate your weightloss and fitness? I lost 20 pounds and 5 inches across my belly in 8 weeks without exercise!Check out my website or shoot me a email for more information

Share this post


Link to post
Share on other sites
MidwayMonster

Here is the full IE portion of this script i wanted to post it seperately as to not cause confusion for the section i am having problems with.

#include <ie.au3>
Opt("TrayIconDebug", 1)
Dim $oTSysID, $oTSystemForm, $oTLoginForm, $email, $emailcheck, $host, $IE_Excel_Populate, $logmsg, $logintroL1, $logintroL2, $logintroL3, $logintroL4, $logintroL5, $logintroL6, $logintroL7, $owadom, $owapwd, $owauid, $proctime, $splashtitle, $startdate, $starttime, $store, $storecheck, $storelen, $tax, $taxlen, $taxtxt
; ###### Script Test variables ######
$IeDate = "20.01.2013" ;day.month.year
$IeStore = "746"
$oTLoginIE = _IECreate ("https://websmp207.sap-ag.de/~form/handler?_APP=00200682500000002332&_EVENT=DISPLAY&ACTION=INSTSRCHLK", 0, 1, 0) ;0 = Dont Attach, 1 = Visable, 0 = Dont wait till fully loaded
$oTLoginIE_Error = @error

WinWait("Windows Security")
WinActivate("Windows Security")
sleep(1000)
Send("******") ;Username
Sleep(1000)
Send("{TAB}")
Send("******") ;Password
Sleep(1000)
ControlClick("Windows Security", "", "[CLASS:Button; INSTANCE:2]")

WinActivate("License Key Request")
sleep(5000)
_IELinkClickByText ($oTLoginIE, "SAP Netweaver")
sleep(5000)
_IELinkClickByText ($oTLoginIE, "New system")
sleep(5000)
; New System Form
;$oTSystemForm = _IEFormGetObjByName ($oTLoginIE, "new_sytem_data") ;For some reason it doesnt find the form via the name
$oTSystemForm = _IEFormGetCollection ($oTLoginIE, 0)
$oTSysID = _IEFormElementGetObjByName ($oTSystemForm, "ff_system_id")
_IEFormElementSetValue ($oTSysID, "XPS")
sleep(1000)
_IELinkClickByText ($oTLoginIE, "Continue", "", 0) ;Returns right away - needed due to it holds for 5 minutes waiting to time out with the popup.

;###### Pop-Up ######
WinWait("Duplicate System ID")
WinActivate("Duplicate System ID")
$oTPopUp = _IEAttach("", "DialogBox", 1) ;Creates a IE Object to interact with
Sleep(1000)
_IELinkClickByText ($oTPopUp, "New System", "", 0) ;Returns right away - needed due to it holds for 5 minutes waiting to time out with the popup.
Sleep(2000)
;#### End Pop-Up ####


WinActivate("License Key Request")

;###### Need to grab form again after popup closed
$oTSystemForm2 = _IEFormGetCollection ($oTLoginIE, 0)


; This works - text based form line
$oTSysName = _IEFormElementGetObjByName ($oTSystemForm2, "ff_system_name")
_IEFormElementSetValue ($oTSysName, $IeStore)
Sleep(2000)

; Drop down - doesnt work
$oTSysType = _IEFormElementGetObjByName ($oTSystemForm2, "ff_system_type")
_IEFormElementSetValue ($oTSystype, "Production support", 1)
;_IEFormElementOptionselect ($oTSysType, 5, 1, "byIndex") ;choosees 6th option Production support
Sleep(2000)

Keith Hugginswww.LivingViLife.com | [email="Keith.Visalus@gmail.com"]Keith.Visalus@gmail.com[/email]Want to automate your weightloss and fitness? I lost 20 pounds and 5 inches across my belly in 8 weeks without exercise!Check out my website or shoot me a email for more information

Share this post


Link to post
Share on other sites
MidwayMonster

Have you tried this?:

_IEAction($oTSysType, "blur")

I just tried this and it drops down the list after entering the value. But doesnt activate the java code.

Keith Hugginswww.LivingViLife.com | [email="Keith.Visalus@gmail.com"]Keith.Visalus@gmail.com[/email]Want to automate your weightloss and fitness? I lost 20 pounds and 5 inches across my belly in 8 weeks without exercise!Check out my website or shoot me a email for more information

Share this post


Link to post
Share on other sites
MidwayMonster

Thanks DanP2 you may have pointed me in the direction of a functional work around. I am concerned that there may be issues with it not being reliably run but it is working on my tests so far. What I ended with was _IEAction($oTSysType, "focus") followed by Send commands with the value and enter. I was then able to apply this to the other 2 drop downs as well... now working with the radio button :-). I am still looking to see if there is a bette way to do this.

$oTSysType = _IEFormElementGetObjByName ($oTSystemForm2, "ff_system_type")
_IEAction($oTSysType, "focus")
;_IEFormElementSetValue ($oTSystype, "Production system", 1)
;_IEFormElementOptionselect ($oTSysType, "Production support", 1, "byValue") ;choosees 6th option Production support
Sleep(1000)
Send("Production system")
Send("{Enter}")
Sleep(4000)

Keith Hugginswww.LivingViLife.com | [email="Keith.Visalus@gmail.com"]Keith.Visalus@gmail.com[/email]Want to automate your weightloss and fitness? I lost 20 pounds and 5 inches across my belly in 8 weeks without exercise!Check out my website or shoot me a email for more information

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  

×