TexasChris 0 Posted December 14, 2012 I need to fire the onclick event for a link but I have no way to identify the object. <div id="button"> <a href="" onclick="some_javascript_here"> <img alt="Add Account" src="images/add_account_button_blue.jpg"> </a> </div> As you can see, I can identify the parent element in the DOM (id="button") but I can't find a way to use that information to target the daughter <a> tag. Any ideas? Share this post Link to post Share on other sites
jdelaney 313 Posted December 14, 2012 $oCol = $oDiv.childnodes Then loop through like: For $oTag in $oCol _ieaction($oTag, "Click") Next you will need logic if there is more than one child node, inside the loop 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. Share this post Link to post Share on other sites
Danp2 888 Posted December 14, 2012 Once you have a reference to the div, you should be able to do the following: $oElement = _IETagNameGetCollection($oDiv, "A", 0) [UDF] WebDriver Latest version Wiki FAQs Share this post Link to post Share on other sites
TexasChris 0 Posted December 14, 2012 Once you have a reference to the div, you should be able to do the following: $oElement = _IETagNameGetCollection($oDiv, "A", 0) Fantastic! Worked like a charm. Jdelaney - Your solution worked as well and I like that it can be used in boader application although DanP2 solution was sufficiant for this specific issue. Thanks for showing me the childnodes code. Crawling the DOM that way will come in handy at some point! Share this post Link to post Share on other sites