Jump to content

Recommended Posts

Posted

Hello. I have page code witch generate dropdown menu on the site...

<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

 

Posted (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 by FrancescoDiMuro

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Posted

@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:

 

Posted

@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:

 

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
×
×
  • Create New...