Jump to content

Recommended Posts

Posted (edited)

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
Posted (edited)

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
Posted (edited)

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
Posted

hmm, maybe with .nextElementSibling Property or .firstElementChild Property, not sure...try

If $oSpan.className = 'aciTreePush' Then
    _IEAction ($oSpan, "click")
    Sleep (750)
    _IEAction ($oSpan.nextElementSibling, "click")
    ExitLoop
  endif

 

Posted

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

 

Posted

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

 

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