Jump to content

javascript dropdownmenu and _ie


Recommended Posts

hi  guys  i have in a page web this dropdown menu this is a code

<a href="javascript:;" role="button" aria-expanded="true" aria-haspopup="true" data-toggle="dropdown" aria-owns="m2749.OptionMenu" aria-controls="m2749.OptionMenu" class="defer-store btn btn-s btn-ter ssixtyDays"><span class="gh-ar-hdn">Vedi gli ordini da</span><span class="filter-content"> Ultimi 60 giorni</span><span class="arrow-down"></span></a>

i try to click over with

Local $oBtns = $oIE.document.GetElementsByTagName("a")
    For $oBtn In $oBtns
        $id = String($oBtn.classname())
        ConsoleWrite($id & @CRLF)

        If $id = "defer-store btn btn-s btn-ter ssixtyDays" Then
            _IEAction($oBtn, "click")
            ;_IEFormElementSetValue($oBtn, $sUser)
        EndIf
    Next

but in console write not find class defer-store btn btn-s btn-ter ssixtyDays, why ?

is possible click over > Ultimi 60 giorni</span>

like  call a text

 

Edited by faustf
Link to comment
Share on other sites

your crystal ball work perfect  :D , but the code where i  insert i just did  do

$oIE.document.parentwindow.execScript('jQuery("div.dropdown.period-menu>a").click()')


    Local $oBtns = $oIE.document.GetElementsByTagName("a")
    For $oBtn In $oBtns
        $id = String($oBtn.classname())
        ;ConsoleWrite($id & @CRLF)

        If $id = "filter-content" Then
            _IEAction($oBtn, "click")
            ;_IEFormElementSetValue($oBtn, $sUser)
        EndIf
    Next

but not work

 

Link to comment
Share on other sites

sorry the code  work open but not remaning open , but  first i want  understund your code

this part of  your code 

div.dropdown.period-menu>a

identifies a correct menu , but where  do you find that  ? in inspect elements i dont saw or exist ? (and simply i dont saw )

 

Link to comment
Share on other sites

i ask some many questions  sorry

i saw in page ropdown.period-menu and a string with javascript start with <a  but why you use > this char and not < ?

second questions if i want click over some menu opened  after , i dont understund how is possible to do that , sorry

 

Link to comment
Share on other sites

As I previously stated, it's a jQuery selector. The ">a" part performs the 2nd step I outlined above. If you wanted child input elements instead of links, then you would change it to ">input". See here for a quick "cheat" sheet. Obviously lots of other good info out there if you search for it. 😉

Here's the complete code to open the dropdown and click one of the available options --

$oIE.document.parentwindow.execScript('jQuery("div.dropdown.period-menu>a").click()')
$oIE.document.parentwindow.execScript('jQuery("div.dropdown.period-menu>ul>li>a:contains('2019')").click()')

I'm sure this could be done without jQuery, but I'll not be a participant in that journey. 😜

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...