Jump to content
Sign in to follow this  
rahoolm

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

Share this post


Link to post
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")

Share this post


Link to post
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

Share this post


Link to post
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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By walec
      Hey
      I have problem with Set Value for control slider on webside.
      Anyone have any idea for a solution?
       
      I tried but it doesn't work.
      Local $Strength = _IEGetObjById($oIE_Strona, "strength_value") Local $oText = _IEFormElementGetObjByName($Strength, "valuee") _IEFormElementSetValue($oText, "6") or
      _IENavigate ($oIE_Strona, "https://guantanamo.prisonwarsonline.com/gym/") Local $oDiv = $oIE_Strona.Document.GetElementByID("strength_value") Local $oAttribute = $oDiv.getAttribute("valuee") If IsObj ( $oAttribute ) Then $oAttribute.value = "6" EndIf Best Regards
    • By triple_N
      Hi, community. Don't know where to debug anymore.
      Before this I received "Frame Notification Bar" listed when run
      Local $sClassList = WinGetClassList("[CLASS:IEFrame]") _writeLog("list CLASS: "&$sClassList ) But after a few time testing, the "Frame Notification Bar" does not listed anymore. Not sure why. Even though I have reverted the code to initial condition. I suspected because not closing IE properly. I have disable and enable back and restart the computer but not yet found back the class.
      My code: 
      if(StringInStr($oTd.innerText, $keyWord)<>0) Then Local $oElements = _IETagNameAllGetCollection($oTd) For $oElement In $oElements if(StringInStr($oElement.innerText, $keyWord)<>0) Then Local $status_click = _IEAction($oElement, "click") If ($status_click = 1) Then _writeLog("Action Success perform - click on selected link: "&$keyWord) Else _writeLog("failed perform Action Link") EndIf Return $status_click EndIf Next EndIf Any help needed.
      Result:
      Success to click Download
      list  CLASS: BrowserFrameGripperClass
      Client Caption
      WorkerW
      ReBarWindow32
      TravelBand
      ToolbarWindow32
      Address Band Root
      AddressDisplay Control
      Edit
      ToolbarWindow32
      ToolbarWindow32
      TabBandClass
      DirectUIHWND
      ControlBandClass
      ToolbarWindow32
      CommandBarClass
      ReBarWindow32
      Frame Tab
      TabWindowClass
      Shell DocObject View
      Internet Explorer_Server
      Version 3.5.4 
    • By Mariog2000
      I've tried for a few days to simply open a url in IE and click an IE object that I can't "TAB" to and don't want to use a mouse-click if at all possible.  I've read up on things like using IEAction and IETagNameGetCollection to find the object but not smart enough to figure out how that works with my url or how to tell if my url is "basic" or a "form", "frameset", "iframe", etc.
      The other problem is I've tried using the "Run" and "ShellExecute" commands to open the browser, which works, but it opens it in a way that doesn't include my currently logged in user account.  For example, if I just click IE or Chrome for that matter and open my default homepage of google, the page that opens knows I'm logged in.  When I use "Send" "ShellExecute" or "_IE_Create" they always open pages generically which would require a login.
      So questions are, if I have a URL I'm trying to open, that's passes the currently logged on users credentials when opening the page (no clue where that happens)
      1.  Are there any code examples someone is willing to share that opens my IE maximized, with logged in credentials, and
      2.  Once that works, can someone suggest a technique a non-developer can find which IE Objects I need to send a "click" to so it opens the correct menu, pop-up, url, etc., associated with that object.  I've copied what doesn't work and sure I'm way off but it's not for a lack of effort. I'll keep trying and post updates but not looking good 🙂
      #include <IE.au3>
      Call ("selection")
      Func selection ()
      Global $oIE = _IECreate ("https://internal-webpage.aspx")
      Local $selectid = _IEGetObjByName ($oIE, "signageNo")
      Local $button = _IEGetObjByName ($oIE, "GO")

      _IEFormElementOptionSelect ($selectid, "3")
      _IEAction ($button,"click")
      EndFunc
      #include <IE.au3> Call ("selection") Func selection () Global $oIE = _IECreate ("https://internal-webpage.aspx") Local $selectid = _IEGetObjByName ($oIE, "signageNo") Local $button = _IEGetObjByName ($oIE, "GO") _IEFormElementOptionSelect ($selectid, "3") _IEAction ($button,"click") EndFunc 1. 
    • By zuladabef
      I want to set the value of a input, but I only have the input name and input id.  I cannot find a form in the source.  Form collection does not return any results.  
      Is there a way to use FormElementSetValue without a form name? Can I use _IEGetObjByName or _IEGetObjById?  If so, how do I set the value once I have the object? Where do I go from here? Local $oIE = _IEAttach("[Website Goes Here"]) Local $oForm = _IEFormGetCollection($oIE, 1) Local $oQuery = _IEFormElementGetCollection($oForm, 4) _IEFormElementSetValue($oQuery, "Set it to this")  
    • By Seminko
      Hey there,
      below function returns an "object collection" (not sure if that's the correct term) of 'a' elements grabbed from within //*[@id="J_DetailMeta"].
      However, I need the returned collection not to include objects with 'aria-disabled = true'. Is there a way of removing specific objects from such a collection?
      Func GetObjectList($sPicker) $oDetailMeta = _IEGetObjById($oIE, "J_DetailMeta") If Not @error Then $tags = $oDetailMeta.GetElementsByTagName("ul") For $tag in $tags $data_ID_value = $tag.GetAttribute("data-property") If $sPicker = "color" Then If $data_ID_value = '????' Or $data_ID_value = "????" Then $oReturnList = $tag.GetElementsByTagName("a") EndIf ElseIf $sPicker = "network" Then If $data_ID_value = '????' Then $oReturnList = $tag.GetElementsByTagName("a") EndIf ElseIf $sPicker = "storage" Then If $data_ID_value = '????' Then $oReturnList = $tag.GetElementsByTagName("a") EndIf EndIf Next EndIf Return $oReturnList EndFunc $oColorList = GetObjectList("color") For $oColor In $oColorList If StringInStr($oColor.GetAttribute("aria-disabled"), "true") <= 0 Then ; remove object from the collection ??? EndIf Next  
×
×
  • Create New...