Selenium IDE: How to check if an element has a focus? Selenium IDE: How to check if an element has a focus? selenium selenium

Selenium IDE: How to check if an element has a focus?


I have had numerous problems detecting if an element has focus because the browser Selenium is controlling typically does not have the focus within the Operating System, and as such the browser will NOT consider any elements to have focus until the browser regains the focus.

I have been pulling my hair out over this, so worked up a solution to this problem. See http://blog.mattheworiordan.com/post/9308775285/testing-focus-with-jquery-and-selenium-or for a full explanation of the problem and a solution to this.

If you can't be arsed to read the lengthy explanation, simply include https://gist.github.com/1166821 BEFORE you include JQuery, and use $(':focus') to find the element that has focus, or .is(':focus') to check if an element has focus.


I wrote that plugin and it is working fine in my environment.Could you provide me a detailed description of how you used it? I would try bugfix it if we will find a bug.