Jump to content
Sign in to follow this  
XinYoung

IE Expand Tree

Recommended Posts

Greetings!

I am in need of your guidance once again. I searched the forums for clicking in span, clicking by class, clicking without an ID or Name, etc., but I am unable to find a solution for my problem.

I am trying to expand this tree in IE. There is an arrow ( > ) that i need to click, but I can't find a way to do it :no:. Alternatively, I can double-click the text "Servers", but that seems to be even more troublesome. I will have to do this 2-3 more times as the tree expands.

There appears to be an ID for the tree, simply called "tree", but that isn't working when I send a click to it.

image.thumb.png.6c663f7500dbaf676e95e044aeee5b72.png

;Open an IE session and navigate to pgAdmin.
Global $oIE = _IECreate($pgAdmin)

;Maximize the IE window.
WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE)

Sleep(2000)

;Expand the tree
$oTree = _IEGetObjById($oIE, "tree")
_IEAction($oTree, "click")

Any ideas?  :poke:

Edited by XinYoung
Took a better screenshot

Share this post


Link to post
Share on other sites

Hi Xin, I see you are still working hard...Try this :

Local $oSpans = _IETagNameGetCollection($oIE, "span")
For $oSpan In $oSpans
  If $oSpan.className = 'aciTreePush' Then
    _IEAction ($oSpan, "click")
    ExitLoop
  Endif
Next

 

Edited by Nine

Share this post


Link to post
Share on other sites

Hey cool. Never saw this before. Thank you!

The very next expansion also appears to be "aciTreePush"

How do I send the next click if they're the same? :huh2:

image.thumb.png.78bdd5f52e5a327ad4546425a6a85149.png

Edited by XinYoung
added screenshot

Share this post


Link to post
Share on other sites

On the nextElementSibling line, I'm getting...

error: _IEAction() called with Const or expression on ByRef-param(s).

 

Share this post


Link to post
Share on other sites

Hmm it's not working (or maybe I implemented the $var wrong). I also tried putting it in there multiple times just in case there are more instances of 'aciTreePush'  but that didn't help.

;Open an IE session and navigate to pgAdmin.
Global $oIE = _IECreate($pgAdmin)
_IELoadWait($oIE)

;Maximize the IE window.
WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE)

;Collect the span tags
Local $oSpans = _IETagNameGetCollection($oIE, "span")

;Click the Servers expand arrow
For $oSpan In $oSpans
    If $oSpan.className = 'aciTreePush' Then
        _IEAction($oSpan, "click")
        Sleep(3000)

        ;Click the DDA expand arrow
        Local $var = $ospan.nextElementSibling
        _IEAction($var, "click")
        ExitLoop
    EndIf
Next

 

Share this post


Link to post
Share on other sites

I see...Try

Local $oSpans, $Count 

For $i = 1 to 2
  $oSpans= _IETagNameGetCollection($oIE, "span")
  $Count = 0
  For $oSpan In $oSpans
    If $oSpan.className = 'aciTreePush' Then
      $Count += 1
      if $Count = $i then
        _IEAction ($oSpan, "click")
        Sleep (1000)
        ExitLoop
      Endif
    Endif
  Next
Next

 

Share this post


Link to post
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
Sign in to follow this  

  • Similar Content

    • By SkysLastChance
      What would be the best way to grab the last digits of this <span>? One of the problems I know I am going to have is sometimes it will be 1 digit other times it might be 3. 

      I am trying to get the list of spans and I get this error.

       
      $oInputs = _IETagNameGetCollection($oIE, "span") $sTxt = "" For $oInput In $oInputs     $sTxt &= $oInput.Innertext & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Form Input Type", "Form: " & $oInput.form.name & @CRLF & @CRLF & "         Types :" & @CRLF & $sTxt)  
    • By nacerbaaziz
      good morning all.
      first lit me give you all a thinks to your help
      you're help me allot thank you all.
      sirs today i've a new problem
      it's not a problem but thing i want to add it to blind accessability.
      the ListBox can send a notification when the user send a double click on it items
      but as we know that the blind users can't use the mouse for that they use the keybord to navigate.
      as we know that the enter replace the double click on the keybord
      for that i need when the user send a inter above any listBox item the list send a double click notification.
      i know some of you tell me that i can use the  GUISetAccelerators function
      but the enter has a other tasks such as leav a blanc line on edits and activate the defaultButton and other tasks.
      that what i need and i hope that you can help me
      this is a simple example.
      #include <GUIConstantsEx.au3> #include <StructureConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <ListBoxConstants.au3> Example() Func Example() Local $sMESSAGE = "The following buttons have been clicked" GUICreate("My GUI list") ; will create a dialog box that when displayed is centered Local $idButton_Add = GUICtrlCreateButton("Add", 64, 32, 75, 25) Local $idButton_Clear = GUICtrlCreateButton("Clear", 64, 72, 75, 25) global $idMylist = GUICtrlCreateList("buttons that have been clicked", 176, 32, 121, 97) GUICtrlSetLimit(-1, 200) ; to limit horizontal scrolling GUICtrlSetData(-1, $sMESSAGE) global $DummyList = GUICtrlCreateDummy() GUICtrlSendToDummy($DummyList, 1) Local $idButton_Close = GUICtrlCreateButton("my closing button", 64, 160, 175, 25) GUIRegisterMsg($WM_command, "WM_command") GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton_Add GUICtrlSetData($idMylist, "You clicked button No1|") Case $idButton_Clear GUICtrlSetData($idMylist, "") Case $idButton_Close MsgBox($MB_SYSTEMMODAL, "", "the closing button has been clicked", 2) Exit case $DummyList $g_iTemp = GUICtrlRead($DummyList) if $g_iTemp = $LBN_DBLCLK then ;$LBN_DBLCLK then msgBox(64, "", "") endIf GUICtrlSendToDummy($DummyList, 0) EndSwitch WEnd EndFunc ;==>Example Func WM_command($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = $lParam $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case GUICtrlGetHandle($idMylist) Switch $iCode Case $LBN_SELCHANGE, $LBN_DBLCLK, $LBN_SELCANCEL, $LBN_SETFOCUS GUICtrlSendToDummy($DummyList, $iCode) case else ;GUICtrlSendToDummy($DummyTreeview, 1) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc  
    • By yffulf
      Is there probably a way to click ie popup button and hide or invisible popup button in the same time?
      I try to use WinSetState @SW_hide ,
      the result is ie crashing or no response because button hide and the next click command won't work...
      $oForm=_IEFormGetObjByName($oIE,"form1") $obutton=_IEFormElementGetObjByName($oForm,"btn_OK") $hWnd = _IEPropertyGet($oIE, "hwnd") _IEAction($obutton,"focus") ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}") WinWait("", "確定存檔嗎?") WinSetState("","確定存檔嗎?",@SW_Hide) ControlClick("", "確定存檔嗎?", "[CLASS:Button; TEXT:確定; Instance:1;]")  
    • By _leo_
      Hey there!
      I am having a problem with clicking a button in IE. As you can see in the code, there would be a class name to click it, but since this button exists several times with exactly the same code, I can only use the "Noch nicht veröffentlicht" to separate it from the others. But this part is just pure text without any classification. 
      "<div class="checkmark" data-v-1e5b1f70=""><svg xmlns="http://www.w3.org/2000/svg" class="icon" viewBox="0 0 16 16" data-v-1e5b1f70=""><circle cx="8" cy="8" r="8" data-v-1e5b1f70="" /></svg></div>Noch nicht veröffentlicht"
      I was trying to click it with:
      #include <IE.au3> local $oNNVs = _IEFormGetCollection($oIE2) For $oNNV in $oNNVs If String($oNNV.innertext) = "Noch nicht veröffentlicht" Then _IEAction($oNNV, "click") EndIf Next and:
      $inputs = $oIE2.document.getElementsByTagName("div") For $input In $inputs If $input.innertext == "Noch nicht veröffentlicht" then $input.click() EndIf Next But nothing seems to work. Thanks for the help!
×
×
  • Create New...