Jump to content

IE.au3 _IEAction Get and Click object without id and having title="Logout"


Recommended Posts

IE.au3 Get and Click object without id and having title="Logout"

I want to get the object from the Web page code is below and click on it.

<td title="Logout" class="icon-button" noWrap="nowrap" itemID="xxx522081682204.21765">

The structure where this td is located is as follows

<form name="myForm">

<div>....

<div>....

<div> id = divToolbar...

<div>

<table....>

<tbody...>

<tr>

<td...........>

<td............>

<td title="Logout" ........>

How to get such object and then perform click operation on it?

I am also attaching the exact html code image.

Is there any general function available?

Thanks in advance for help.

post-52640-0-03041500-1325581778_thumb.p

Link to comment
Share on other sites

I am getting the following message in the console.

--> IE.au3 V2.4-0 Warning from function _IEGetObjById, $_IEStatus_NoMatch (Logout)

--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType

with the code below:

$oLogout = _IEGetObjById($oIE, "Logout")

and

this error

--> IE.au3 V2.4-0 Warning from function _IEGetObjByName, $_IEStatus_NoMatch (Name: Logout, Index: 0)

--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType

while using this code

$oLogout = _IEGetObjByName($oIE, "Logout")

Link to comment
Share on other sites

What makes you think you can simply use the title attribute in place of a name or an id? Of course you get NoMatch.

You'll probaly want to use _IETagnameGetCollection($oIE, "td", index) perhaps in combination with _IETableGetCollection and you can scope your td collection into a specific table and replace $oIE with a table reference in the former call.

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

Hi,

you can match the title in a loop, if you get the tag collection (_IETagNameGetCollection).

Edit: What Dale said

#include <IE.au3>


$sURL = "file:///" & @ScriptDir & "\foo594206.html"
$oIE = _IECreate($sURL)

$oForm = _IEFormGetObjByName($oIE, "myForm") ; get the object of the form
$oTable = _IETableGetCollection($oForm, 0) ; get the object of the first table in the form
$oElems = _IETagNameGetCollection($oTable, "td") ; get object of all td tags

For $oElem In $oElems ; loop over td tag collection
    If $oElem.title == "Logout" Then ; if the title matches we have our target
        ConsoleWrite("The text inside of the <td> with title 'Logout' is: " & $oElem.innerText & @CRLF)
    EndIf
Next

Edited by Robjong
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...