Jump to content

_IE Clicking Button, no name, no form.


Recommended Posts

How would i clock the following button?

<input class="redButt" type="button" onclick="restart();" title="" value="Restart..."></input>

FULL HTML below---------------
<html><head> … </head><body onunload="closeActivePopup();"><div id="pageHeader"> … </div><br></br><table width="90%" cellspacing="0" cellpadding="0" border="0" summary=""> … </table><table width="100%" cellspacing="0" cellpadding="0" border="0" summary=""> … </table><br></br><table cellspacing="0" cellpadding="4" border="0" summary="" cols="3"><tbody><tr> … </tr><tr><td nowrap=""><input class="redButt" type="button" onclick="restart();" title="" value="Restart..."></input></td></tr></tbody></table><div id="tutorialDiv" style="position: absolute; top: 10px; right: 10px; visibility: hidden;"> … </div></body></html>

 

This is in an iframe, i know about referencing the frame properly, etc. i can navigate and interact with the website no problems....just this one button not having a name is throwing me .  

 

Link to comment
Share on other sites

I'm not sure if this helps but I like to dump it to a text file...

Func FuncGetElmentsByTag()

    Local $oLinks = _IELinkGetCollection($oIE)
    $txtLinks = FileOpen("links.txt", 2)
    For $oLink In $oLinks
        Local $sLinkText = _IEPropertyGet($oLink, "innerText")
        FileWrite($txtLinks, "LINK: " & $oLink.href & @CRLF & "INNERTEXT: " & @CRLF & @CRLF)
    Next
    FileClose($txtLinks)
    ConsoleWrite("Done finding links" & @LF)

    Local $oElements = _IETagNameAllGetCollection($oIE)
    $tagname = FileOpen("TagName.txt", 2)
    For $oElement In $oElements
        FileWrite($tagname, "Tagname: " & $oElement.tagname & @CRLF & "innerText: " & $oElement.innerText & @CRLF & "-----" & @CRLF)
    Next
    FileClose($tagname)
    ConsoleWrite("Done finding elements" & @LF)

EndFunc   ;==>FuncGetElmentsByTag

You can then do something like this::::

$tags = _IETagNameGetCollection($oIE, "span")
            For $tag In $tags
                ;Get name of target tag
                If String($tag.className) = "the tags class name goes here" Then
                    $target = $tag.innertext
                EndIf


            Next

_IEAction($target , "click")

-K

Link to comment
Share on other sites

You can use the function in my signature.  Examples are on the thread as well.

Your xpath would be:

$xpath = "//input[@class='redButt']"

the function returns an array of the objects that match.  If the UBounds is greater than 1, you can add additional criteria, like

$xpath = "//input[@class='redButt' and contains(@onclick,'restart')]"

The iFrame must be the object passed into the function.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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...