Jump to content

[Solved]Selection by Table Class Name


Recommended Posts

I am trying to select a table by class name, so I am using _IETagnameGetCollection and parsing through the tables returned to get the classname ($oTable.className). I can get a list of the tables no problem, but when I try to run an if statement to select that table name, it doesn't work right.

If $oTable.className = "TheList" Then

I also tried:

If $sText = "TheList" Then

Either way, when I use a msgbox or consolewrite, the value of the classname or the $sText variable is 0, yet it runs the If part and not the Else part.

What the heck...

$oTables = _IETagnameGetCollection($oIE, "table")
$index = 0
For $oTable in $oTables
    $sText = $oTable.className
    If $sText = "TheList" Then
        ;ConsoleWrite("[" & $sText & "]" & @CR)
        MsgBox(4096, "Stop", "[" & $sText & "]" & @CR)
        ConsoleWrite($index & ":- [" & $oTable.className & "]" & @CR)
        ;$oTable = _IETagnameGetCollection($oIE, "table", $index)
        $aTableData = _IETableWriteToArray ($oTable, True)
        _ArrayDisplay($aTableData)
        ExitLoop
    Else
        ConsoleWrite($index & ":  [" & $oTable.className & "]" & @CR)
        $index += 1
    EndIf
Next
ConsoleWrite($index & ":END [" & $oTable.className & "]" & @CR)

Thoughts? What am I doing wrong???

Thanks !!

Edited by BreCalmor
Link to comment
Share on other sites

If String($oTable.className) = "TheList" Then

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

For those who are not familiar with the issue, when $oTable.className finds no match, it returns an integer 0, the expression is then deemed by autoit to be a numeric comparison... any string on the right side evaluates as an integer 0 and 0 = 0 is true. Using the String function on the left forces a string comparison.

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