Jump to content

Error from _IEFormElementOptionSelect


Recommended Posts

Hi,

I am unable to perform a simple _IEFormElementOptionSelect task. Though I am well versed with it somehow in this case i am totally stuck. Kindly help. Below is my code.

This is what I have on the webpage

<select name="peExceptionReason" id="peExceptionReason">
    <option value="" selected="selected"></option>
    <option value="NO_STRAT">Stratification is not in place on this account.</option>
    <option value="OTHER">Other (*Additional Information Required)</option>
</select>

My Code:

Local $oForm = _IEFormGetObjByName($oIE, "outage_processEventComplete")
$Reason = _IEGetObjById($oForm, "peExceptionReason")
_IEFormElementOptionSelect($Reason, "Other (*Additional Information Required)", 1, "byText")
_IEFormElementOptionSelect($Reason, "OTHER", 1, "byValue")

Error:

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidObjectType

 

Link to comment
Share on other sites

5 minutes ago, Danp2 said:

Shouldn't this be

$Reason = _IEFormElementGetObjByName($oForm, "peExceptionReason")

?

I tried as you suggested, Danp2

Local $oForm = _IEFormGetObjByName($oIE, "outage_processEventComplete")
Local $Reason = _IEFormElementGetObjByName($oForm, "peExceptionReason")
_IEFormElementOptionSelect($Reason, "Other (*Additional Information Required)", 1, "byText")
_IEFormElementOptionSelect($Reason, "OTHER", 1, "byValue")

And output:

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEFormElementGetObjByName, $_IESTATUS_NoMatch
--> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidDataType

 

Link to comment
Share on other sites

I found something strange. The problem is with the name of the element and hence _IEFormElementOptionSelect is not working.

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: peExceptionReason, Index: 0)
--> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidDataType

But now the question is how to identify this element? The webpage says below

<form id="outage_processEventComplete" name="outage_processEventComplete" action="/services/oneview/was/outage.processEventComplete.action" method="post" enctype="multipart/form-data" class="ibm-row-form ibm-styled compact-form">

<input type="hidden" name="outageId" value="1051433" id="outageId">
<div class="ibm-columns">
<input type="hidden" name="peEventId" value="L2_TRANSFER" id="peEventId">
<input type="hidden" name="peOutageId" value="1051433" id="peOutageId">
<input type="hidden" name="peTargetTimeId" value="" id="peTargetTimeId">
<input type="hidden" name="peLateReasonId" value="" id="peLateReasonId">
<p>
<b>Transfer to OPS2</b>
</p>
<p>
<b>Completion Time:</b>

<input type="text" name="peCompletionTime" size="25" value="" id="1051433CT_L2_TRANSFER_CT">

<b>Exception:</b>

<input type="checkbox" name="peException" value="true" id="peException" onclick="javascript:exceptionChecked(this,L2_TRANSFER_ERID);"><input type="hidden" id="__checkbox_peException" name="__checkbox_peException" value="true">

</p>

<p id="L2_TRANSFER_ERID">

<b>Exception Reason:</b>
<select name="peExceptionReason" id="peExceptionReason">
    <option value="" selected="selected"></option>
    <option value="NO_STRAT">Stratification is not in place on this account.</option>
    <option value="OTHER">Other (*Additional Information Required)</option>
</select>
</p>

<p>
<b>Late Reason:</b>
<select name="peLateReason" id="peLateReason">
    <option value=""></option>
    <option value="01 - Operations was notified of the critical issue late by the customer">01 - Operations was notified of the critical issue late by the customer</option>
    <option value="02 - Operations was notified of the critical issue late due to a monitoring error">02 - Operations was notified of the critical issue late due to a monitoring error</option>
    <option value="03 - Problem with OneView impeded creation or transfer of the OneView entry">03 - Problem with OneView impeded creation or transfer of the OneView entry</option>
    <option value="04 - Operations was working with support to identify problem details">04 - Operations was working with support to identify problem details</option>
    <option value="05 - Operations was working with the problem reporter to identify problem details">05 - Operations was working with the problem reporter to identify problem details</option>
    <option value="06 - Issue was not initially designated a critical event, or the severity changed">06 - Issue was not initially designated a critical event, or the severity changed</option>
    <option value="07 - Multiple situations were occurring at the same time">07 - Multiple situations were occurring at the same time</option>
    <option value="08 - Other Technical Problem (Additional Explanation Required)">08 - Other Technical Problem (Additional Explanation Required)</option>
    <option value="09 - Other (Additional Explanation Required)">09 - Other (Additional Explanation Required)</option>
</select>
</p>
<p>
<b>Completion Notes:</b>
<textarea name="peCompletionNotes" cols="80" rows="10" id="peCompletionNotes" onchange="javascript:checkLength(this,2044);" spellcheck="true"></textarea>
</p>
<div class="ibm-col-1-1">
<p align="center">

<input type="submit" id="outage_processEventComplete_0" value="Submit" class="ibm-btn-pri">

</p>
</div>
</div>
</form>

 

Link to comment
Share on other sites

Another breakthrough

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: peExceptionReason, Index: 0)
Frame number 0: Object not found! 
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: peExceptionReason, Index: 0)
Frame number 1: Object not found!

Now how to locate this element? Please help

Edited by sammy1983
Link to comment
Share on other sites

Haven't done much with the IE udf yet but since I'm willing to learn and help I gave it a try.

 

Can you try the following code?

 

Local $oForm = _IEFormGetObjByName($oIE, "outage_processEventComplete")
Local $oSelect = _IEFormElementGetObjByName($oForm, "peExceptionReason")

_IEAction($oSelect, "focus")

_IEFormElementOptionSelect($oSelect, "Other (*Additional Information Required)", 1, "byText")

 

Link to comment
Share on other sites

You could also try:

#include <IE.au3>

Local $oIE = _IECreate("", 1)
Local $oSelects = _IETagNameGetCollection($oIE, "Select")
Local $oOptions
For $oSelect in $oSelects
    If $oSelect.id = "peExceptionReason" Then
        $oOptions = _IETagNameGetCollection($oSelect, "Option")
        For $oOption In $oOptions
            If StringStripWS($oOption.InnerText, 7) = "Other (*Additional Information Required)" Then $oOption.Selected = True
        Next
    EndIf
Next

 

Link to comment
Share on other sites

10 hours ago, sammy1983 said:

Still waiting for help... :(

You have us at a disadvantage since you haven't told us the URL nor have you provided a copy of the complete HTML. If you are unable to do this, then you need to help us help you by providing more details.

For example, does the website use frames? If so, which frame contains the desired object? Etc.

Link to comment
Share on other sites

16 hours ago, Subz said:

You could also try:

#include <IE.au3>

Local $oIE = _IECreate("", 1)
Local $oSelects = _IETagNameGetCollection($oIE, "Select")
Local $oOptions
For $oSelect in $oSelects
    If $oSelect.id = "peExceptionReason" Then
        $oOptions = _IETagNameGetCollection($oSelect, "Option")
        For $oOption In $oOptions
            If StringStripWS($oOption.InnerText, 7) = "Other (*Additional Information Required)" Then $oOption.Selected = True
        Next
    EndIf
Next

 

Thanks Subz.. I tried the method but couldn't see the desired result though it ended with no errors

Link to comment
Share on other sites

13 hours ago, Danp2 said:

You have us at a disadvantage since you haven't told us the URL nor have you provided a copy of the complete HTML. If you are unable to do this, then you need to help us help you by providing more details.

For example, does the website use frames? If so, which frame contains the desired object? Etc.

Danp2.. Unfortunately as this is for my company, I am not authorized to reveal the URL in public forum. However, with regard to frames I already posted about it. For your convenience I am posting it again. Let me know your thoughts.

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: peExceptionReason, Index: 0)
Frame number 0: Object not found! 
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: peExceptionReason, Index: 0)
Frame number 1: Object not found!

 

Link to comment
Share on other sites

For time being, I am using "Send" command which I am not comfortable of using but I don't have any other choice.

_IELinkClickByText($oIE, "No")

    Sleep(2000)

    Send("{TAB 3}")
    Send("{DOWN 9}")
    Send("{TAB}")
    Send("{NUMPADDOT}")

    Sleep(2000)

    ; Below code will find elements with no "Name" of "Id"
    $oLinks = _IETagNameGetCollection($oIE, "input")
    For $oLink In $oLinks
        If String($oLink.type) = "submit" And String($oLink.value) = "Submit" Then
            _IEAction($oLink, "click")
        EndIf
    Next

 

Link to comment
Share on other sites

3 minutes ago, Danp2 said:

Yes... I understand. I also saw your earlier post. However, you didn't how us the code you ran to get it. Therefore, I'm left to guess that there are two frames. And I've no further idea as to why _IEGetObjByName is failing in your case.

; Below code finds the Frame where the element resides
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $oFrame = 0

For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)

    $oInput1 = _IEGetObjById($oFrame, "0")

    If @error Then
        ConsoleWrite("Frame number " & $i & ": Object not found! " & @CRLF)
    Else
        ConsoleWrite("Frame number " & $i & ": Object found! " & @CRLF)
    EndIf
Next

 

Edited by sammy1983
Link to comment
Share on other sites

6 minutes ago, Danp2 said:

You previously showed us some HTML where the is was "peExceptionReason". Why are you using "suspensionReasonCode" here instead?

My bad. That was by mistake. I have a template and I copy pasted it. Below is the code which I used in this case

; Below code finds the Frame where the element resides
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
;~ Local $oFrame = 0

For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)

    $oInput1 = _IEGetObjById($oFrame, "peExceptionReason")

    If @error Then
        ConsoleWrite("Frame number " & $i & ": Object not found! " & @CRLF)
    Else
        ConsoleWrite("Frame number " & $i & ": Object found! " & @CRLF)
    EndIf
Next

And this is the error output

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (peExceptionReason)
Frame number 0: Object not found! 
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (peExceptionReason)
Frame number 1: Object not found!

Tried using _IEGetObjByName as well

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: peExceptionReason, Index: 0)
Frame number 0: Object not found! 
--> IE.au3 T3.0-2 Warning from function _IEGetObjByName, $_IESTATUS_NoMatch (Name: peExceptionReason, Index: 0)
Frame number 1: Object not found!

 

Edited by sammy1983
Link to comment
Share on other sites

2 minutes ago, Subz said:

After 

For $oSelect in $oSelects

Can you add the following and run via Scite and let us know what the output is in the Console?

ConsoleWrite("ID: " & $oSelect.id & @CRLF & "Name: " & $oSelect.name & @CRLF)

Here is the output

ID: peLateReason
Name: peLateReason
ID: peExceptionReason
Name: peExceptionReason
ID: peLateReason
Name: peLateReason
ID: peLateReason
Name: peLateReason
ID: peExceptionReason
Name: peExceptionReason
ID: peLateReason
Name: peLateReason
ID: peExceptionReason
Name: peExceptionReason
ID: peLateReason
Name: peLateReason
ID: TICKETING_SYSTEM
Name: outage.ticketingSystem
ID: CHANGE_SYSTEM
Name: outage.changeSystem
ID: FAILURE_TYPE
Name: outage.type
ID: CRITICAL
Name: outage.critical
ID: SEVERITY
Name: outage.severity
ID: ORIG_SEVERITY
Name: outage.origSeverity
ID: HAS_SLA
Name: outage.hasSla
ID: OWNERSHIP
Name: outage.ownership
ID: CAUSED_BY_GDC
Name: outage.causedByGdc
ID: WAIT_STATE
Name: currentWaitState
ID: PROFILE_SWITCH
Name: webSession.userProfileId
ID: LOGIN_STATUS
Name: webSession.status
ID: peExceptionReason
Name: peExceptionReason
ID: peLateReason
Name: peLateReason

 

Link to comment
Share on other sites

So do you have two forms on the page with the same ID?  Strange that it appears twice as Id should only be used once per page.

If you also add after the For $oOption In $oOptions

ConsoleWrite($oOption.InnerText & @CRLF)

What does that return?

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...