Jump to content

[Solved] How to Get the Focused Element in a WebPage?


 Share

Recommended Posts

  • Moderators

You can use the activeElement property.

#include <IE.au3>

Global $sActiveElement = "", $sActiveElementOld = ""

_IEErrorHandlerRegister()
$oIE_form = _IE_Example("form")

While __IEIsObjType($oIE_form, "browserdom")
    $sActiveElement = $oIE_form.document.activeElement.tagName
    If $sActiveElement <> $sActiveElementOld Then
        $sActiveElementOld = $sActiveElement
        ConsoleWrite("Tag Name of focused element: " & $sActiveElement & @CR)
    EndIf
    Sleep(100)
WEnd
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...