Jump to content

IE find a dynmic link


Recommended Posts

So I have 2 links on a webpage, the txt can be anything, the href changes too but not the domain of link. I found that this.....

For $x = 0 To 164
Local $oInputs = _IETagNameGetCollection($oIE, "a", $x)
If StringInStr($oInputs.id, "ctl00_ctl00_ctl00_ctl00_ContentMain_ContentMain_ContentMain_ContentMain_TabContainer1_DetailsTab_DetailsController1_ctl00_ParcelSummary1_TitleSection") > 0 Then $ParcelID = $oInputs.href
Next

Is a crude way to find a link but it adds unnecessary seconds to the script. Is there a better way to find find these guys on the webpage? I mean a way to do with without looping through every possible link.

I would put the source of page but its long. Here is a link to an example.

Posted Image

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
Share on other sites

The HREF of the link is the same as the URL in the address bar.

Addressbar: http://www.ocpafl.org/Searches/ParcelSearch.aspx/PID/312214078800170

Href-Link in the page: href="/Searches/ParcelSearch.aspx/PID/312214078800170"

If you click on the link, the same page shows again.

Why not take the addressbar data?

$ParcelID = _IEPropertyGet($oIE,"locationurl")
Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

@exit

The normal address is http://www.ocpafl.org/Searches/ParcelSearch.aspx it happed to change to the right link because I was testing it. Assume the address bar will be http://www.ocpafl.org/Searches/ParcelSearch.aspx. Any other solutions?

@tlman12

The website it turns out is kind of dynamic. A certain amount of links will appear under conditions I cant anticipate so a parse by index wont really work unless I look at every link and filter to what I am looking for but that takes extra time.

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
Share on other sites

#include <IE.au3>
#include <String.au3>
;   sample URL $URL = "http://www.ocpafl.org/Searches/ParcelSearch.aspx/PID/312214078800170"
$URL = "http://www.ocpafl.org/Searches/ParcelSearch.aspx"
$oIE = _IECreate($URL)
MsgBox(262144, " ", "Please navigate to the desired page and then click OK", 0)
$oID = _IEGetObjById($oIE, "ctl00_ctl00_ctl00_ctl00_ContentMain_ContentMain_ContentMain_ContentMain_TabContainer1_DetailsTab_DetailsController1_ctl00_ParcelSummary1_TitleSection")
If @error Then Exit MsgBox(262144, "Exit due to error", "Error: " & @error & " Extended: " & @extended & @LF & 'ID not found: "ctl00_ctl00_ctl00_ctl00_ContentMain_ContentMain_ContentMain_ContentMain_TabContainer1_DetailsTab_DetailsController1_ctl00_ParcelSummary1_TitleSection"', 0)
MsgBox(262144, "href string",  $oid.href)

Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

#include <IE.au3>
#include <String.au3>
; sample URL $URL = "http://www.ocpafl.org/Searches/ParcelSearch.aspx/PID/312214078800170"
$URL = "http://www.ocpafl.org/Searches/ParcelSearch.aspx"
$oIE = _IECreate($URL)
MsgBox(262144, " ", "Please navigate to the desired page and then click OK", 0)
$oID = _IEGetObjById($oIE, "ctl00_ctl00_ctl00_ctl00_ContentMain_ContentMain_ContentMain_ContentMain_TabContainer1_DetailsTab_DetailsController1_ctl00_ParcelSummary1_TitleSection")
If @error Then Exit MsgBox(262144, "Exit due to error", "Error: " & @error & " Extended: " & @extended & @LF & 'ID not found: "ctl00_ctl00_ctl00_ctl00_ContentMain_ContentMain_ContentMain_ContentMain_TabContainer1_DetailsTab_DetailsController1_ctl00_ParcelSummary1_TitleSection"', 0)
MsgBox(262144, "href string", $oid.href)

Ah! Never thought about doing it that way, Thanks!

No problem can withstand the assault of sustained thinking.Voltaire

_Array2HTMLTable()_IEClassNameGetCollection()_IEquerySelectorAll()

Link to comment
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
 Share

×
×
  • Create New...