Codeception:检查元素是否具有焦点? [英] Codeception: Check if element has focus?

查看:54
本文介绍了Codeception:检查元素是否具有焦点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以断言某个元素(例如输入或链接)具有键盘焦点?我正在将Codeception与Selenium结合使用。在 http://codeception.com/docs/modules/WebDriver 上找不到任何内容

Is there a way to assert that an element (e.g. input or link) has the keyboard focus? I'm using Codeception with Selenium. Couldn't find anything on http://codeception.com/docs/modules/WebDriver

推荐答案

可靠的消息来源告诉我这可行:

A reliable source told me this works:

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

测试愉快!

这篇关于Codeception:检查元素是否具有焦点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆