Jump to content
Sign in to follow this  
DavidTunnell

Getting an IE object for something that doesn't have an ID

Recommended Posts

DavidTunnell

I am trying to move my mouse to a location independent of screen resolution.

AfiA3li.png

The reason is this is a dropdown menu and because the site is largly coded in php there is no link to get to backups that i can reference directly. 

The problem is that it doesn't have an id:

<li class="l1"><a>Protect</a><ul class="l2"><li class="l2 navLinks " page="backups"><a>Backups</a></li></ul></li>

I tried the following:

$ProtectObject = _IEGetObjById($IEObject, "Protect")
$ProtectXCoord = _IEPropertyGet($IEObject, "screenX")
$ProtectYCoord = _IEPropertyGet($IEObject, "screenY")
MouseMove($ProtectXCoord,$ProtectYCoord)

But it is not finding it.

How do I go about this?

Share this post


Link to post
Share on other sites
dragan

how about this:
 

$allAelements = _IETagNameGetCollection($IEObject, "a")
if IsObj($allAelements) Then
    For $oneAelement in $allAelements
        If $oneAelement.innertext == "Protect" Then
            _IEAction($oneAelement, "Focus")
            _IEAction($oneAelement, "Click")
            ExitLoop
        EndIf
    Next
EndIf
Edited by dragan
  • Like 1

Share this post


Link to post
Share on other sites
DavidTunnell

 

how about this:

 

$allAelements = _IETagNameGetCollection($IEObject, "a")
if IsObj($allAelements) Then
    For $oneAelement in $allAelements
        If $oneAelement.innertext == "Protect" Then
            _IEAction($oneAelement, "Focus")
            _IEAction($oneAelement, "Click")
            ExitLoop
        EndIf
    Next
EndIf

 

Very interesting Prodigy. However text 'Protect' is not actually what's being clicked. Once the mouse moves over this location it shows 'Backup' this is what needs to be clicked.

Additionally, the link is not in the page source. I believe it is being rendered with AJAX. Is it possible to get the mouse coordinates of the string 'Protect'?

Edited by DavidTunnell

Share this post


Link to post
Share on other sites
DavidTunnell

LOOSE THE MOUSEMOVE()

8)

 

I would like to but I don't see an alternative since there is no link in the source and you can't access the 'Backup' without a mouseover.

I am open to additional ideas but this works:

$allAelements = _IETagNameGetCollection($IEObject, "a")
if IsObj($allAelements) Then
    For $oneAelement in $allAelements
        If $oneAelement.innertext == "Protect" Then
            $ProtectXCoord = _IEPropertyGet($oneAelement, "screenX")
            $ProtectYCoord = _IEPropertyGet($oneAelement, "screenY")
            ExitLoop
        EndIf
    Next
EndIf
MouseMove($ProtectXCoord,$ProtectYCoord)

Thanks Prodigy!

Edited by DavidTunnell

Share this post


Link to post
Share on other sites
dragan

the "Backup" doesn't pop up after "Focus" and "Click" IE Actions? If so, would this help?:
 

$allAelements = _IETagNameGetCollection($IEObject, "a")
if IsObj($allAelements) Then
    For $oneAelement in $allAelements
        If $oneAelement.innertext = "Protected" Then
            $oneAelement.fireEvent("onmouseover")
            ;... if "Backup" popped up search for "Backup" element
            ;the same way and simulate "focus"+"click" on it here:
            ;...
            ExitLoop
        EndIf
    Next
EndIf

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  

×