Sign in to follow this  
Followers 0
Zohar

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

5 posts in this topic

#1 ·  Posted (edited)

Hello

Let's say I have a webpage with 3 Textboxes, How can I know which 1 is currently Focused?

Thank you

Edited by Zohar

Share this post


Link to post
Share on other sites



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
1 person likes this

Share this post


Link to post
Share on other sites

very nice

thank you, to both of you

(:

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  
Followers 0