badhabit73 Posted July 30, 2018 Posted July 30, 2018 Hello. I have page code witch generate dropdown menu on the site... expandcollapse popup<div class="filters-indicator-cell inline-block"> <div class="js-filter"><div><div data-bind="sp_select: { value: Code, source: Options, isLink: true }"><div class="sp-select-control"><div data-bind="classes: { dropdown: not(Up), dropup: Up }" class="dropdown"> <button class="dropdown-toggle js-toogle-button sp-fake-link" type="button" data-toggle="dropdown" data-bind="classes: { disabled: not(Enabled), 'sp-fake-link': IsLink, 'full-width': not(IsLink) }, sp_add_class: BtnClass" title="Действующие" aria-expanded="false"> <div class="pull-left value-container vertical-middle"> <div class="js-value ellipsis">Действующие</div> </div> <div class="caret hide" data-bind="sp_toggle: not(IsLink)"></div> <i class="sp-i-menu-down vertical-middle" data-bind="sp_toggle: IsLink"></i> </button> <ul class="dropdown-menu js-items"><li><span class="item-name pointer" data-bind="text: Name">Любой</span></li><li><span class="item-name pointer" data-bind="text: Name">Действующие</span></li><li><span class="item-name pointer" data-bind="text: Name">Недействующие</span></li><li class="divider"><span class="item-name pointer" data-bind="text: Name">IsDivider</span></li><li><span class="item-name pointer" data-bind="text: Name">В состоянии ликвидации</span></li><li><span class="item-name pointer" data-bind="text: Name">В состоянии банкротства</span></li><li><span class="item-name pointer" data-bind="text: Name">В состоянии реорганизации</span></li></ul> </div> </div></div></div></div> </div> <div class="form-remove-cell inline-block"> <span class="form-remove-cell__icon js-remove hide" data-bind="sp_toggle: none(IsPredefined,IsDependent)"></span> </div> </div> </div> </div></div><div class="sp-analysis-param"><div class="relative sp-selection-param-row" data-bind="sp_toggle: not(Hide)"> <div class="form-body"> <div class="form-row"> <div class="form-indicator-cell inline-block"> <div class="js-visibility"><div><div class="pointer" data-bind="sp_toggle: HasResult"> <div class="vertical-top"> <i class="sp-i-eyes-active js-visibility-tooltip indicator-in-order" data-bind="sp_toggle: Visibility" data-original-title="" title=""></i> <i class="sp-i-eyes-active-strikeout js-visibility-tooltip indicator-in-order hide" data-bind="sp_toggle: not(Visibility)" data-original-title="" title=""></i> </div> <div class="inline-block indicator-name"> <span data-bind="text: Name">Мои списки</span> <i class="vertical-middle sp-i-info js-help-tooltip hide" data-bind="sp_toggle: Help"></i> </div> how can I select menu item "Любой" in this dropdown menu? I tried thisway, but itsn't work... Local $oDD = $oIE.document.getElementsByClassName("filters-indicator-cell inline-block").item(0) if IsObj($oDD) Then _IEAction($oDD, "focus") _IEFormElementOptionSelect($oDD, "Любой", 1, "byText") EndIf
FrancescoDiMuro Posted July 30, 2018 Posted July 30, 2018 Hi @badhabit73, and welcome to the AutoIt forum Did you see if you have any error returned by _IEAction() or _IEFormElementOptionSelect()? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
badhabit73 Posted July 30, 2018 Author Posted July 30, 2018 Yes. Quote --> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidObjectType
FrancescoDiMuro Posted July 30, 2018 Posted July 30, 2018 (edited) Try this, and post the result Local $oDD = $oIE.document.getElementsByClassName("filters-indicator-cell inline-block").item(0) If IsObj($oDD) Then _IEAction($oDD, "focus") If @error Then ConsoleWrite("Error in _IEAction: " & @error & @CRLF) Else _IEFormElementOptionSelect($oDD, "Любой", 1, "byText") If @error Then ConsoleWrite("Error in _IEFormElementOptionSelect: " & @error & @CRLF) EndIf EndIf EndIf Edited July 30, 2018 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
badhabit73 Posted July 30, 2018 Author Posted July 30, 2018 Quote --> IE.au3 T3.0-2 Error from function _IEFormElementOptionSelect, $_IESTATUS_InvalidObjectType Error in _IEFormElementOptionSelect: 4
FrancescoDiMuro Posted July 30, 2018 Posted July 30, 2018 @badhabit73 Seems that you are trying to click on a <div> element, instead of a <li> element, because of this: Local $oDD = $oIE.document.getElementsByClassName("filters-indicator-cell inline-block").item(0) Try to change this above with: Local $oDD = $oIE.document.getElementsByClassName("dropdown-menu js-items").item(0) Maybe this work Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
badhabit73 Posted July 30, 2018 Author Posted July 30, 2018 Local $oDD = $oIE.document.getElementsByClassName("dropdown-menu js-items").item(0) same error.... Quote Error in _IEFormElementOptionSelect: 4
FrancescoDiMuro Posted July 30, 2018 Posted July 30, 2018 @badhabit73 I really don't know... Seems that the object is return correctly, otherwise the script wouldn't enter in the If IsObj() statement... In this case, seems that you can't use _IEFormElementOptionSelect() function, but I'm not sure about that. Let's see if some expert of DOM "manipulation" could help you more Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
badhabit73 Posted July 30, 2018 Author Posted July 30, 2018 Thank you for help. Will wait for "DOM manupulation" experts...)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now