cancel
Showing results for 
Search instead for 
Did you mean: 

HTML Check if object has the focus

SOLVED
Highlighted
Contributor

HTML Check if object has the focus

Hi 



I was wondering how you would check in TC if a HTML object like a textbox currently has the focus. 



I have tried the document.HasFocus but does not work for me. 



any ideas
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Staff

RE: HTML Check if object has the focus

Try to use document.activeElement property. It will return the native web object, so it will not have TestComplete specific properties and methods.

View solution in original post

2 REPLIES 2
Highlighted
Staff

RE: HTML Check if object has the focus

Try to use document.activeElement property. It will return the native web object, so it will not have TestComplete specific properties and methods.

View solution in original post

Highlighted
Contributor

RE: HTML Check if object has the focus

Thanks I used the Document.ActiveElement.Name property to determine of the property is equal to the objectname 



Thanks
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors