flmbray Posted December 24, 2009 Posted December 24, 2009 I have an object on a web page that I need to click. It isn't a link and it doesn't have an id. It is a TD with a class on it, but so do many other TDs (with the same class). I have a specific XPath to the object: /html/body/form/div[2]/div[3]/div[3]/div[2]/table/tbody/tr/td[2] (I got this from Firebug in Firefox.) How can I use IE.au3 to obtain and click this specific object? TIA!
Stilgar Posted December 24, 2009 Posted December 24, 2009 I have an object on a web page that I need to click. It isn't a link and it doesn't have an id. It is a TD with a class on it, but so do many other TDs (with the same class). I have a specific XPath to the object: /html/body/form/div[2]/div[3]/div[3]/div[2]/table/tbody/tr/td[2] (I got this from Firebug in Firefox.) How can I use IE.au3 to obtain and click this specific object? TIA! I don't know if that with IE works but with the FF.au3 you can do this: _FFClick( _FFXpath("//form/div[2]/div[3]/div[3]/div[2]/table/tbody/tr/td[2]", "", 9 ) ) jEdit4AutoIt PlanMaker_UDF
DaleHohm Posted December 26, 2009 Posted December 26, 2009 (edited) XPath is only available in IE via the MSXML object and not the InternetExplorer document object, so it is not so convenient. Your "selector" (/html/body/form/div[2]/div[3]/div[3]/div[2]/table/tbody/tr/td[2]) should work this way: $oElement = $oIE.document.body _ .getElementsByTagname("form").item(0) _ .getElementsByTagname("div").item(2) _ .getElementsByTagname("div").item(3) _ .getElementsByTagname("div").item(2) _ .getElementsByTagname("table").item(0) _ .getElementsByTagname("tbody").item(0) _ .getElementsByTagname("tr").item(0) _ .getElementsByTagname("td").item(2) Dale Edited December 26, 2009 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
nguoibachviet Posted April 8, 2010 Posted April 8, 2010 _FFClick( _FFXpath("//form/div[2]/div[3]/div[3]/div[2]/table/tbody/tr/td[2]", "", 9 ) ) i think you trying to rape mediafire.
PsaltyDS Posted April 8, 2010 Posted April 8, 2010 XPath is only available in IE via the MSXML object and not the InternetExplorer document object, so it is not so convenient. Your "selector" (/html/body/form/div[2]/div[3]/div[3]/div[2]/table/tbody/tr/td[2]) should work this way: $oElement = $oIE.document.body _ .getElementsByTagname("form").item(0) _ .getElementsByTagname("div").item(2) _ .getElementsByTagname("div").item(3) _ .getElementsByTagname("div").item(2) _ .getElementsByTagname("table").item(0) _ .getElementsByTagname("tbody").item(0) _ .getElementsByTagname("tr").item(0) _ .getElementsByTagname("td").item(2) Dale Oooh. Very cool syntax, Dale. Thanks for that demo, as I have a specific application for it at work! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Kinhow Posted May 26, 2012 Posted May 26, 2012 What if I have an id or class in the middle? how this should work?//*[@id="details"]/div[2]/div[2]/div/div[1]/h3/span/span[1].getElementsByTagname("id?").item(0) _
jdelaney Posted May 29, 2012 Posted May 29, 2012 (edited) I'm working on one it's in my signature. Right now, there are several conditions...and i just had a breakthrough in one unfortunatly, with your xpath provided, i can already point out, i have not made use of the '*' or specifiying the 2nd such div '[2]' Edited May 29, 2012 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.
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