Jump to content

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


Go to solution Solved by dragan,

Recommended Posts

Posted

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?

Posted

Local $oForm = _IEFormGetObjByName($IEObject, "f") ; form name
Local $oQuery = _IEFormElementGetObjByName($oForm, "Protect")
_IEFormElementSetValue($oQuery, "Protect")

it should look more like this... NOT TESTED

I would not use Mousemove() in this type of situation.

 

8)

NEWHeader1.png

Posted
  On 9/10/2013 at 8:26 PM, Valuater said:
Local $oForm = _IEFormGetObjByName($IEObject, "f") ; form name
Local $oQuery = _IEFormElementGetObjByName($oForm, "Protect")
_IEFormElementSetValue($oQuery, "Protect")

it should look more like this... NOT TESTED

I would not use Mousemove() in this type of situation.

 

8)

 

The text is not within a form.

  • Solution
Posted (edited)

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

  On 9/10/2013 at 8:42 PM, dragan said:

 

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
Posted (edited)
  On 9/10/2013 at 8:48 PM, Valuater said:

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
Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...