Read more

How to find out the currently focused DOM element with JavaScript

Arne Hartherz
December 03, 2012Software engineer at makandra GmbH

This works in all relevant browsers:

document.activeElement
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

You can use this in your Selenium steps, for example, to assert that a form field is or is not focused.

Posted by Arne Hartherz to makandra dev (2012-12-03 13:38)