Codeception: Check if element has focus?

Viewed 2083
3 Answers

To complete the @sunomad's answer. If you use the code line :

$I->executeJS('return $("#element").is(":focus")');

You got this error :

[Facebook\WebDriver\Exception\UnknownServerException] unknown error: $ is not a function

Switch $ by jQuery

$I->executeJS('return jQuery("#element").is(":focus")');

And it works !

Related