Sign in to follow this  
Followers 0
Vakari

_IETagNameAllGetCollection / _IETagNameGetCollection

10 posts in this topic

#1 ·  Posted (edited)

I using these 2 functions to try and learn a little more about interacting with various webpages and I'd like to find out some more info about data I can extract.

For example, this is the code shown in the help file for _IETagNameAllGetCollection

#include <IE.au3>
$oIE = _IE_Example ("basic")
$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
    MsgBox(0, "Element Info", "Tagname: " & $oElement.tagname & @CR & "innerText: " & $oElement.innerText)
Next

As far as the $oElement objects go, what other types of information can be gathered by using .* ? Is there a list or website that has a list of all available options for the object? What is the .* part of the line called anyway?

I've seen .tagname, .innertext, .id, .value... I'm curious to know the other types that I can use.

Thank you for your time.

Edited by Vakari

Share this post


Link to post
Share on other sites



That question does not have an easy answer other than to say "See the links in my sig and go start learning your way around MSDN." or "go buy a book on the browser DOM (Document Object Model)". In particular, take a look at the DHTML references in my sig.

It helps to have a sound conceptual understanding od Object Oriented programming and knowing what objects, properties, methods and events are. It is not an easy task and it is at the core of why I created IE.au3 in the first place -- to try to help people gain access to the benefits of that programming model without having to first be immersed in it.

I'd suggest you start reading, tear into the sources for IE.au3 to see how it does what it does and then ask specific questions to help you get through the rabbit hole.

Dale


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

Share this post


Link to post
Share on other sites

The "DHTML Objects" link in your sig provided the answers that I was looking for. Until I saw that page, I didn't see the relation between the website code and autoit script object properties. Once I got that down, I was able to improve my method of filling out various forms. Instead of using Send() to send strings and {Tab}s and whatnot, I can now fill them in directly. Below is the first method I used to fill in some fields and checkboxes:

$oInputs = _IETagNameGetCollection($oIE, "input"); Input Fields
For $oInput In $oInputs
    If $oInput.name = "RITD_NAME" Then $oInput.Value = "COMPANY NAME - PolType"
    If $oInput.name = "CONTENT.POLEFFDATEmin"  Then $oInput.Value = "01/01/2003"
    If $oInput.name = "CONTENT.POLEFFDATEmax"  Then $oInput.Value = "01/01/2008"
    If $oInput.name = "RITD_NOTIFYIND" Then $oInput.Checked = False
    If $oInput.name = "CONTENT.GP_FINANCIAL_SLRmin" Then $oInput.Value = "1"
    If $oInput.name = "OPTIONS.RPTTITLE" Then $oInput.Value = "COMPANY NAME"
    If $oInput.name = "OPTIONS.TXTTRLR" Then $oInput.Checked = False
Next

I'm sure there is a better and more efficient way of doing it, but thats what I have so far, and I couldn't have done it to begin with if I hadn't had your input and signature :D

Thanks a ton for your help Dalehohm.

Share this post


Link to post
Share on other sites

You're welcome.

For the record, there are _IE functions for setting the value of any form field... _IEFormElement*

Dale


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

Share this post


Link to post
Share on other sites

So last, but not least, I'll need to submit the form I fill out by click a "Submit" link on the page. The code for this is as follows:

<td align="center">&nbsp;|&nbsp;</td><td align="center"><span class="clsButton" onclick="BasicRequest.action = BasicRequest.action + 'submit';BasicRequest.submit();" onmouseover="this.style.textDecoration = 'underline'" onmouseout="this.style.textDecoration = 'none'">Submit</span></td>

This is what I'm using now to click it: (Which I found in another one of the links in your signature :D )

$oInputs = _IETagNameGetCollection($oIE, "span")
; @extended would be 38 at this point
    For $oInput in $oInputs
        If $oInput.id = 0 Then
            $oInput.Click; Clicks the first 'span' then exits the For loop
            ExitLoop
        EndIf
    Next

It works, but I don't like it. I think I'm just getting lucky with it since the submit button just happens to be the first 'span' on the page where .id returns 0. For some reason I can't seem to return $oInput.class, $oInput.onclick, or anything more helpful. The script crashes anytime I try to pull anything other than .id .

Would you happen to know of a better alternative?

Share this post


Link to post
Share on other sites

try

If String(_IEPropertyGet($oInput, "innerText")) = "Submit" Then

Dale


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

Share this post


Link to post
Share on other sites

Ah dangit, _IEPropertyGet() didn't even cross my mind ><, but neither did innerText.

I'll give this a shot and let you know how it goes.

Once again, I appreciate all of your help. The (ugly version of the) script is coming along nicely now that you have given me some new knowledge and ideas.

Share this post


Link to post
Share on other sites

Just wanted to say thank you for the help!  I was looking everywhere and found this - Thank you both!  Just putting in my code! 

:ILA2:

$oInputs = _IETagNameGetCollection($oIE, "span")
; @extended would be 38 at this point
    For $oInput in $oInputs
        If String(_IEPropertyGet($oInput, "innerText")) = "Details" Then
            $oInput.Click; Clicks the first 'span' then exits the For loop
            ExitLoop
        EndIf
    Next


"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Just wanted to say thank you for the help!  I was looking everywhere and found this - Thank you both!  Just putting in my code! 

:ILA2:

$oInputs = _IETagNameGetCollection($oIE, "span")

; @extended would be 38 at this point

    For $oInput in $oInputs

        If String(_IEPropertyGet($oInput, "innerText")) = "Details" Then

            $oInput.Click; Clicks the first 'span' then exits the For loop

            ExitLoop

        EndIf

    Next

 

A simple "Like This" button click is a lot better than necro posting a 6 years old topic, please pay more attention to topic and replies date before posting next time.

Share this post


Link to post
Share on other sites

Just wanted to say thank you for the help!  I was looking everywhere and found this - Thank you both!  Just putting in my code! 

:ILA2:

$oInputs = _IETagNameGetCollection($oIE, "span")

; @extended would be 38 at this point

    For $oInput in $oInputs

        If String(_IEPropertyGet($oInput, "innerText")) = "Details" Then

            $oInput.Click; Clicks the first 'span' then exits the For loop

            ExitLoop

        EndIf

    Next

 

souldjer777... Thank you so much for posting your code to this thread... in spite of the suggestion that it is an old topic, I have been looking for your specific example... and, as it happens, this post was the #1 return in my search engine SERP when I entered "autoit variable object".

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