问题描述
我想测试我的表单是否可访问,以及我是否可以在输入元素之间切换.我发现这个 github 问题在这里要求该功能:
这使您能够:
cy.get('input').tab()//和cy.get('input').tab({shift: true})
然而,实际的选项卡实现不会是一个单独的命令,所以如果你使用这个插件,你必须在原生事件登陆时重构你的测试代码
I want to test that my forms are accessible and that I can tab between my input elements. I found this github issue asking for the feature here:https://github.com/cypress-io/cypress/issues/299
Currently I try to do .type('{tab}')
and I get the following error:
Is there a current workaround for the lack of tab support?
The Cypress team is currently working on implementing tab
support along with other keyboard keys as part of Native Events
In the meantime I've made a plugin that adds a .tab()
command. cypress-plugin-tab
:
This enables you to do:
cy.get('input').tab()
// and
cy.get('input').tab({shift: true})
However, the actual tab implementation will not be a separate command, so know if you use this plugin, you'll have to refactor your test code when Native Events lands
这篇关于赛普拉斯:键入 tab 键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!