BodeleyTunes Posted March 17, 2010 Share Posted March 17, 2010 I have a list of cars in an auction, I want to click on the "Detail" text link which then shows the details of each car in the list. The site uses a lot of java script and forms. How can I click on the detail link in the html below: <TD class=VehicleList>1219<BR>4192</TD> <TD class=overG bgColor=#ffcc33 width=15 align=right> <DIV style="TEXT-ALIGN: center; BACKGROUND-COLOR: #ffcc33; FONT-WEIGHT: bold"><A onclick=sendNextPage(); href="predtslct01_en.jsp?type=0&display=list&conferenceid=6&holdingid=1219&auctionid=4192" target=_self>Detail</A> </DIV></TD></TR></TBODY></TABLE></TD> <TD> Can anyone help!? Im stuck again! So far I have tried IEget tags and obj by name etc and not got close to homing in on the links or even counting through the links to find an index? Cheers, Jon. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 17, 2010 Share Posted March 17, 2010 Get the collection of all links with _IELinkGetCollection(), then loop through them looking for $oLink.innerText = "Detail". 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 Link to comment Share on other sites More sharing options...
BodeleyTunes Posted March 17, 2010 Author Share Posted March 17, 2010 OK thanks I shall try that! Get the collection of all links with _IELinkGetCollection(), then loop through them looking for $oLink.innerText = "Detail". Link to comment Share on other sites More sharing options...
BodeleyTunes Posted March 17, 2010 Author Share Posted March 17, 2010 OK I tried it but nothing happend, no error message or anything. I forgot to to say that the text of the link "detail" is not unique, its a big list of cars you can click on as below, so maybe it got confused? This is what I just tried. $colLinks = _IELinkGetCollection($oIE) For $oLink in $colLinks If String($oLink.innerText) = "Detail" Then _IEAction($oLink, "click") ExitLoop EndIf Next Get the collection of all links with _IELinkGetCollection(), then loop through them looking for $oLink.innerText = "Detail". Link to comment Share on other sites More sharing options...
BodeleyTunes Posted March 17, 2010 Author Share Posted March 17, 2010 Is there a way I can run a few tests on it to see if Im looking at the right part. Eg. frames etc. I also tried this earlier but to no avail. $oFormListings = _IEFormGetObjByName($oIE, "form1") $oDivs = _IETagNameGetCollection($oIE, "DIV") For $oDiv In $oDivs If String(_IEPropertyGet($oDiv, "InnerText")) = $sSearch Then _IEAction($oDiv, "click") _IELoadWait($oIE) ExitLoop EndIf Next OK I tried it but nothing happend, no error message or anything. I forgot to to say that the text of the link "detail" is not unique, its a big list of cars you can click on as below, so maybe it got confused? This is what I just tried. $colLinks = _IELinkGetCollection($oIE) For $oLink in $colLinks If String($oLink.innerText) = "Detail" Then _IEAction($oLink, "click") ExitLoop EndIf Next Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 17, 2010 Share Posted March 17, 2010 If the table is inside any frames/forms you will have to drill down into the DOM to get the links. Use a DOM Inspector, like DebugBar for IE or DOM_Inspector for Firefox, to find the path. 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 Link to comment Share on other sites More sharing options...
BodeleyTunes Posted March 17, 2010 Author Share Posted March 17, 2010 I've been trying to use firebug, this is all new to me I barely know what DOM is, but I'll go away and research thanks! Jon. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 17, 2010 Share Posted March 17, 2010 All I meant was for example, if the page has a frame, which contains another frame, which contains some forms, one of which contains the table with the links: 1. Get the first frame (from $oIE) 2. Use that to get the child frame (from $oFrame1) 3. Use that to get the form (from $oFrame2) 4. Use that to get the links collection (from $oForm) 5. I don't think you have to worry about drilling into any DIVs or the table before getting the links. Hope that clears it up. 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 Link to comment Share on other sites More sharing options...
BodeleyTunes Posted March 17, 2010 Author Share Posted March 17, 2010 (edited) OK, It seems to be inside a frame called "form1" but its also nested in loads of tables and the odd DIV. Do I have to also mention them to zoom in on this pesky "detail" link? I have a screenshot of how the DOM is laid out below with the "detail" link hightlighted... So far I have tried this: $oframelistings = _IEFrameGetObjByName($oIE, "form1") $colLinks = _IELinkGetCollection($oframelistings) For $oLink in $colLinks If String($oLink.innerText) = "Detail" Then _IEAction($oLink, "click") ExitLoop EndIf Next If the table is inside any frames/forms you will have to drill down into the DOM to get the links. Use a DOM Inspector, like DebugBar for IE or DOM_Inspector for Firefox, to find the path. Edited March 17, 2010 by BodeleyTunes Link to comment Share on other sites More sharing options...
BodeleyTunes Posted March 17, 2010 Author Share Posted March 17, 2010 Getting a bit of a basic error, it cant find the form? --> IE.au3 V2.4-0 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch --> IE.au3 V2.4-0 Error from function _IELinkGetCollection, $_IEStatus_InvalidDataType Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 18, 2010 Share Posted March 18, 2010 I'm not an HTML guy, but I still don't think you have to worry about that DIV tag, and should be able to go straight to the FORM. Using your DOM Inspector, show the details of that parent FORM tag. 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 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