Select and update dropbox menu

柔情痞子 提交于 2020-03-04 17:00:54

问题


I'm trying to select an item from a list box (table element which in fact is a textarea) using VBA (Excel).

I'm able to select the item (by changing the Value) but the problem is that when I press the button "Save" the site returns the following error :

The Status Reason field requires a value when the status is either pending or resolved. Select the status reason from the menu. (ARERR 1291220)

I think this happens because the list box does not get updated.

Listbox (which is not a real Listbox):

<textarea title="" class="text sr " id="arid_WIN_1_1000000881" style="left: 117px; top: 0px; width: 223px; height: 21px;" rows="1" cols="20" wrap="off" readonly="" arencryptdataatrest="0" arautoctt="400" arautocak="0" mdd="1" mstyle="2" armenu="SYS:RSN:StatusReason-Q-HPD-HelpDesk" maxlen="40"></textarea>

My code:

Dim post As Object, evt As Object
Set evt = .Document.createEvent("keyboardevent")
evt.initEvent "change", True, False

Set post = .Document.getElementByID("arid_WIN_1_1000000881")
    post.Value = "No Further Action Required"
post.dispatchEvent evt

Please let me know if you need further information.

[Update]

Below is the full code of the table that shows after pressing the listbox

<div class="MenuOuter" style="left: 338px; top: 127px; width: 225px; height: 114px; visibility: inherit; z-index: 100007;" armenuelementserial="0"><div class="MenuScrollUp" style="width: 223px; visibility: hidden;">▲</div><iframe src="https://extranet.inditex.com/arsys/resources/html/Blank.html" frameborder="0" scrolling="no" style="border: currentColor; border-image: none; left: 0px; top: 0px; width: 100%; height: 100%; display: block; position: absolute;"></iframe><div class="MenuTableContainer"><table class="MenuTable" style="width: 223px;" cellspacing="0" cellpadding="0"><tbody class="MenuTableBody"><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">Automated Resolution Reported</td><td class="MenuEntryNoSub" arvalue="Automated Resolution Reported"></td></tr><tr class="MenuTableRow"><td class="MenuEntryNameHover" nowrap="">Customer Follow-Up Required</td><td class="MenuEntryNoSubHover" arvalue="Customer Follow-Up Required"></td></tr><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">Temporary Corrective Action</td><td class="MenuEntryNoSub" arvalue="Temporary Corrective Action"></td></tr><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">Future Enhancement</td><td class="MenuEntryNoSub" arvalue="Future Enhancement"></td></tr><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">Monitoring Incident</td><td class="MenuEntryNoSub" arvalue="Monitoring Incident"></td></tr><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">No Further Action Required</td><td class="MenuEntryNoSub" arvalue="No Further Action Required"></td></tr><tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">(clear)</td><td class="MenuEntryNoSub" arvalue=""></tr></tbody></table></div><div class="MenuScrollDown" style="width: 223px; visibility: hidden;">▼</div></div>

And a screenshot showing the listbox.

I want to update the value of the Status Reason field after changing the value (which I'm already able to do), note that the Status Reason items are updated after the item chosen in Status list box (Status list box is an input item and I can successfully edit the value and update it).

[Update 1]

Now I'm able to find the drop-down list which appears after pressing the button near the Status Reason text area.

First I click on the button to see the drop-down list with

.Document.getElementsByClassName("df arfid1000000881 ardbnzID_Status_Reason Char")(0).getElementsByClassName("btn btn3d menu")(0).Click

Now I successfully find the correct row inside the table with

.Document.getElementsByClassName("MenuTable")(0).Rows(5)

But when I do .Click nothing happens, I tried also with FireEvent and Selected = True (the last one gives me an error)

[Update 2]

When I click the button to open the drop-down list, there's is a GET callback, same happens when I click an item from the drop-down list.

<ExpandMenu>

Request URL: https://extranet.inditex.com/arsys/BackChannel/?param=283%2FExpandMenu%2F35%2FSYS%3ARSN%3AStatusReason-Q-HPD-HelpDesk6%2Fitxars13%2FHPD%3AHelp%20Desk6%2Fitxars28%2FSYS%3AStatus%20Reason%20Menu%20Items103%2F1%5C1%5C1%5C4%5C1%5C1%5C1000000101%5C2%5C4%5C13%5CHPD%3AHelp%20Desk%5C4%5C1%5C1%5C1000000186%5C99%5C7%5C4%5C1%5C1%5C7%5C2%5C6%5C1%5C4%5C1%5C1%5C1000004827%5C2%5C6%5C0%5C0%2F1%2F01%2F05%2F1%2F1%2F715%2F1%2F10%2F4%20Resolved5%2F1%2F1%2F62%2F0%2F2%2F0%2F2%2F0%2F2%2F0%2F2%2F0%2F2%2F0%2F&sToken=MCNY-LTDA-W512-T7V8-J5GS-JHN4-58XW-VYAK
<GetEntryList>

Request URL: https://extranet.inditex.com/arsys/BackChannel/?param=266%2FGetEntryList%2F6%2Fitxars13%2FHPD%3AHelp%20Desk18%2FBest%20Practice%20View6%2Fitxars28%2FSYS%3AStatus%20Reason%20Menu%20Items0%2F71%2F1%5C4%5C1%5C99%5C1000000881%5C1%5C1000000009%5C4%5C1%5C2%5C4%5C13%5CHPD%3AHelp%20Desk%5C1%5C1000000101%5C15%2F1%2F10%2F100000088131%2F1%2F26%2FNo%20Further%20Action%20Required5%2F1%2F1%2F45%2F1%2F1%2F01%2F01%2F21%2F715%2F1%2F10%2F1000004336&sToken=MCNY-LTDA-W512-T7V8-J5GS-JHN4-58XW-VYAK

来源:https://stackoverflow.com/questions/60419037/select-and-update-dropbox-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!