Sign in to follow this  
Followers 0
BodeleyTunes

Clicking on a dynamically generated link

11 posts in this topic

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&amp;display=list&amp;conferenceid=6&amp;holdingid=1219&amp;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.

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

OK thanks I shall try that! :)

Get the collection of all links with _IELinkGetCollection(), then loop through them looking for $oLink.innerText = "Detail".

:(

Share this post


Link to post
Share on other sites

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?

Posted Image

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".

:(

Share this post


Link to post
Share on other sites

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?

Posted Image

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#9 ·  Posted (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...

Posted Image

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 by BodeleyTunes

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0