Gwildor Posted August 13, 2013 Share Posted August 13, 2013 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 More sharing options...
AutID Posted August 13, 2013 Share Posted August 13, 2013 try _IETagNameGetCollection https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
Gwildor Posted August 13, 2013 Author Share Posted August 13, 2013 (edited) How would i get a print of "the collection" so i can see what is found? Edited August 13, 2013 by Gwildor Link to comment Share on other sites More sharing options...
AutID Posted August 13, 2013 Share Posted August 13, 2013 Go check the help files for the _IETagNameGetCollection. As far as I see type and value would be enough to get control of that button and then do whatever you to with it. https://iblockify.wordpress.com/ Link to comment Share on other sites More sharing options...
Keltset Posted August 14, 2013 Share Posted August 14, 2013 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 More sharing options...
jdelaney Posted August 15, 2013 Share Posted August 15, 2013 (edited) 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 August 15, 2013 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now