Vakari Posted April 24, 2008 Share Posted April 24, 2008 (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 April 24, 2008 by Vakari Link to comment Share on other sites More sharing options...
DaleHohm Posted April 24, 2008 Share Posted April 24, 2008 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 Link to comment Share on other sites More sharing options...
Vakari Posted April 24, 2008 Author Share Posted April 24, 2008 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 Thanks a ton for your help Dalehohm. Link to comment Share on other sites More sharing options...
DaleHohm Posted April 24, 2008 Share Posted April 24, 2008 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 Link to comment Share on other sites More sharing options...
Vakari Posted April 24, 2008 Author Share Posted April 24, 2008 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"> | </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 ) $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? Link to comment Share on other sites More sharing options...
DaleHohm Posted April 24, 2008 Share Posted April 24, 2008 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 Link to comment Share on other sites More sharing options...
Vakari Posted April 24, 2008 Author Share Posted April 24, 2008 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. Link to comment Share on other sites More sharing options...
souldjer777 Posted June 4, 2014 Share Posted June 4, 2014 Just wanted to say thank you for the help! I was looking everywhere and found this - Thank you both! Just putting in my code! $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 sayArtist: Middle Class Rut Link to comment Share on other sites More sharing options...
Palestinian Posted June 4, 2014 Share Posted June 4, 2014 Just wanted to say thank you for the help! I was looking everywhere and found this - Thank you both! Just putting in my code! $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. Link to comment Share on other sites More sharing options...
ccbamatx Posted July 6, 2014 Share Posted July 6, 2014 Just wanted to say thank you for the help! I was looking everywhere and found this - Thank you both! Just putting in my code! $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". 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