Jump to content

DOM Stuff


tommytx
 Share

Recommended Posts

<

$hog = _IETagNameGetCollection ($oIE, "button")

For $x In $hog

Msgbox(0, "", $x.name)

Next

>

This loop finds two buttons with names on the page.

Button 1 and Button 2... I seem to be missing something, how can I capture the second button name as I have tried the following code...

$y = $hog[0].name

$z = $hog[1].name

This is the variable I want..

I must be formatting it wrong... as the loop above displays what I am looking for, and I want to capture the second one in the variable $z but it does not work... what have I done wrong?

When the for loop above runs it displays the name of the two buttons... perfectly...

But I cannot seem to capture them. The links I am using throw an error.

Link to comment
Share on other sites

Thanks for the suggestion, but the name changes on every load so I do not have the name, I have to wait for to load to find out what it is..

However I find this works but is cumbersome.

$hog = _IETagNameGetCollection ($oIE, "button")

For $x In $hog

$dat = $x.name

Next

msgbox(0,"",$dat)

So what happens is when the loop finished $dat end up with the last variable in the iteration and that works fine, but only because the last one [0], [1] of the two items is the one I want so its still in $dat and I can use it ok, but what I really need is the format to grab it without the loop..

its something like $dat = $hog[1].name or $hog.name[1] but they don't seem to work.

Can anyone see my error?

Link to comment
Share on other sites

$oButton1 = _IETagNameGetCollection ($oIE, "button", 0)

$oButton2 = _IETagNameGetCollection ($oIE, "button", 1)

ConsoleWrite("Button1: " & $oButton1.name & @CRLF)

ConsoleWrite("Button2: " & $oButton2.name & @CRLF)

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...