Jump to content
monarch684

_IEFormElementGetObjByName Not Work Correctly

Recommended Posts

monarch684

After banging my head on the wall a few times and short of throwing the computer out the window............

This is not working.  I get "Warning from function _IEFormElementGetObjByName, $_IESTATUS_NoMatch" when the Change Route Partition runs.

; Enter Directory Number
Local $oForm = _IEFormGetObjByName($oIE,"directoryNumberForm")
Local $oName = _IEFormElementGetObjByName($oForm, "dnorpattern")
_IEFormElementSetValue($oName, $uext)
Sleep(10000)

; Change Route Partition
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkroutepartition")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "d9ce81ea-d5c5-b15a-149a-0159456a5ad5")

Here is the HTML it is pulling from:

<FORM method=post name=directoryNumberForm action=/ccmadmin/directoryNumberEdit.do>
....
....
....
<SELECT onchange=isfkroutepartitionValid(this) onblur=refreshOnPartition(this) style="WIDTH: 316px" size=1 name=fkroutepartition>
    <OPTION selected value="">&lt; None &gt;</OPTION>
    ....
    ....
    ....
    <OPTION value=d9ce81ea-d5c5-b15a-149a-0159456a5ad5>USM-DN-PT</OPTION>
    ....
    ....
    ....
</SELECT>   
....
....
....
....
</FORM>

The above HTML is from a network appliance web interface, so I have to work with what it gives me.

 

_IEFormElementGetObjByName is used several times in the script and at this particular point decides not to work!?!  Any help will help with my insanity right now.

Share this post


Link to post
Share on other sites
Freewolny

What about _IETagNameGetCollection and checking a name (or getting fixed index, if that would do)?

Share this post


Link to post
Share on other sites
monarch684

Using _IEGetObjByName I get the following:

Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: fkroutepartition, Index: 0)

 

Share this post


Link to post
Share on other sites
monarch684

New revelation.....It appears that variables are no longer being set at line 147.  Is there a way to blow away all set variables?

Share this post


Link to post
Share on other sites
jguinch

With your HTML source, it works with these two codes :

$oIE = _IECreate(@ScriptDir & "\Test.html")
$oForm = _IEFormGetObjByName($oIE,"directoryNumberForm")
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkroutepartition")
_IEFormElementOptionSelect($oSelect, "d9ce81ea-d5c5-b15a-149a-0159456a5ad5")

and

$oIE = _IECreate(@ScriptDir & "\Test.html")
$oSelect = _IEGetObjByName($oIE, "fkroutepartition")
_IEFormElementOptionSelect($oSelect, "d9ce81ea-d5c5-b15a-149a-0159456a5ad5")

There is something wrong somewhere else in your code...

Share this post


Link to post
Share on other sites
monarch684

Here is the complete code.

; Testing Variables
Global $uname = ""
Global $pwd = ""
Global $uhrnum = ""
Global $uext = ""
Global $duname = ""

; Start Jabber Setup
#include <IE.au3>

; Open Web Console and Wait for Load
Global $oIE = _IECreate("https://*************/ccmadmin/showHome.do")

; Send Username & Password
Local $oForm = _IEFormGetObjByName($oIE,"logonform")
Local $oUname = _IEFormElementGetObjByName($oForm, "j_username")
Local $oPwd = _IEFormElementGetObjByName($oForm, "j_password")
_IEFormElementSetValue($oUname, $uname)
_IEFormElementSetValue($oPwd, $pwd)
_IEFormSubmit($oForm)

; Navigate to Capabilities Assignment
_IENavigate($oIE,"https://*************/ccmadmin/capassignFindList.do")

; Set User HR Number and Search
Local $oForm = _IEFormGetObjByName($oIE,"capassignFindListForm")
Local $oText = _IEFormElementGetObjByName($oForm, "searchString0")
_IEFormElementSetValue($oText, $uhrnum)
_IEFormSubmit($oForm)

; Get Link to Modify User
_IELinkClickByText($oIE, $uhrnum)

; Verify CUP and CUPC are Enabled
Local $oForm = _IEFormGetObjByName($oIE,"capassignForm")
_IEFormElementCheckBoxSelect($oForm, 1, "",0,"byIndex")
_IEFormElementCheckBoxSelect($oForm, 1, "",1,"byIndex")
_IEFormSubmit($oForm)

; Navigate to List Phones
_IENavigate($oIE,"*************/ccmadmin/phoneEdit.do")

; Set Option to CUCSF and Submit
Local $oForm = _IEFormGetObjByName($oIE,"phoneForm")
Local $oSelect = _IEFormElementGetObjByName($oForm, "tkmodel")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "503")
_IEFormSubmit($oForm)

; Set Device Name
Local $oForm = _IEFormGetObjByName($oIE,"phoneForm")
Local $oName = _IEFormElementGetObjByName($oForm, "name")
_IEFormElementSetValue($oName, "CSF" & $uext)

; Set Description
Local $oDesc = _IEFormElementGetObjByName($oForm, "description")
_IEFormElementSetValue($oDesc, "US5 " & $duname & " " & $uext)

; Set Device Pool
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkdevicepool")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "0f8019b9-0069-59f0-5e02-3a873e6bb2b6")

; Set Phone Button Template
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkphonetemplate")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "8e1a10fa-a52c-4435-a4ec-540d266c8c37")

; Set Calling Search Space
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkcallingsearchspace")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "8462f516-112b-b875-0b4d-9ac3f828655a")

; Set AAR Calling Search Space
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkcallingsearchspace_aar")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "60e4e653-5653-aa9d-9436-5c3ce97f4fc3")

; Set Media Resource Group List
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkmediaresourcelist")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "28d6ccdf-9114-28db-906c-4a1c7f7158fc")

; Set AAR Group
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkaarneighborhood")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "5efbf00a-fec9-3c0b-d6b7-4a319e697323")

; Set User Locale
Local $oSelect = _IEFormElementGetObjByName($oForm, "tkuserlocale")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "1")

; Set Primary Phone
Local $oSelect = _IEFormElementGetObjByName($oForm, "ikdevice_primaryphone")

_IEAction($oSelect, "focus")
Send("{TAB}{ENTER}")
Sleep(1000)

; Find Phone Popup
WinActive("Find and List Phones - Internet Explorer")
Send("{TAB 3}")
Send("{Down 2}")
Send("{TAB 2}")
Send($uext)
Send("{ENTER}")
Sleep(2000)
Send("{TAB 17}")
Send("{SPACE}")
Send("{TAB 9}")
Send("{ENTER}")

; Set Device Security Profile
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkSecurityProfile")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "c6085e14-a32c-4c5e-a3d1-8daf60d81594")

; Set SUBSCRIBE Calling Search Space
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkCallingSearchSpace_Restrict")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "4c954640-da11-3b39-0619-829c21aad7ec")


; Set Device Security Profile
Local $oSelect = _IEFormElementGetObjByName($oForm, "fkSIPProfile")
_IEAction($oSelect, "focus")
_IEFormElementOptionSelect($oSelect, "d5e200ed-70cd-13fe-5c07-6ea8bbfd3f1a")
Local $saveBtn = _IEGetObjById($oIE, "Save")
_IEAction($saveBtn, "click")
Sleep(10000)
;; Issue with message box popup


; Click Line 1 - Add a new DN
_IELinkClickByText($oIE, " Line [1] - Add a new DN")

; Enter Directory Number
Local $oForm = _IEFormGetObjByName($oIE,"directoryNumberForm")
Local $oName = _IEFormElementGetObjByName($oForm, "dnorpattern")
_IEFormElementSetValue($oName, $uext)
Sleep(5000)

; Change Route Patition

Send("{TAB 2}")
Send("{Down 99}")
Send("{TAB}")

;~ ; Change Route Partition
;~ Local $oSelect = _IETagNameGetCollection($oForm, "select",1)
;~ _IEAction($oSelect, "focus")
;~ _IEFormElementOptionSelect($oSelect, "d9ce81ea-d5c5-b15a-149a-0159456a5ad5")

Sleep(5000)
; Set Display Value
Local $oName = _IEFormElementGetObjByName($oForm, "display")
_IEFormElementSetValue($oName, $duname)

; Set ACSII Display
Local $oName = _IEFormElementGetObjByName($oForm, "displayascii")
_IEFormElementSetValue($oName, $duname)

; Set Line Text Label
Local $oName = _IEFormElementGetObjByName($oForm, "label")
_IEFormElementSetValue($oName, $duname &" - "& $uext)

; Set ASCII Line Text Label
Local $oName = _IEFormElementGetObjByName($oForm, "labelacsii")
_IEFormElementSetValue($oName, $duname &" - "& $uext)

Any the "Send" commands is where I was having issues and just put them there to pass by that particular spot until I figure out the coding issue there.

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

×