Forum Discussion

maxthomassin's avatar
maxthomassin
Occasional Contributor
12 years ago
Solved

Get the focused object

Is there a way to get the focused item of my webpage?



For exemple, I would like to move to an object using Tab and then get THAT item.



all.Item("codeUtilisateur").Keys("[Tab][Tab][Tab]");



Now the selected item has changed and I would like to retrieve it.



Thanks !



  • If you need to set focus to the specific item, then just call its focus() method.

    But if you need to know what item will be focused after using [Tab], then I suggest using document.activeElement property. Though it will not be the TestComplete web object.

2 Replies

  • If you need to set focus to the specific item, then just call its focus() method.

    But if you need to know what item will be focused after using [Tab], then I suggest using document.activeElement property. Though it will not be the TestComplete web object.
  • maxthomassin's avatar
    maxthomassin
    Occasional Contributor
    Thank you, this is what I was looking for. (document.activeElement)