admin管理员组文章数量:1356878
I need to navigate through the keyboard pressing ALT+F10.
I know that is possible to type mands like this:
cy.focused().type('{alt}')
How can I add the F10 key to this mand?
Thanks
I need to navigate through the keyboard pressing ALT+F10.
I know that is possible to type mands like this:
cy.focused().type('{alt}')
How can I add the F10 key to this mand?
Thanks
Share Improve this question asked May 23, 2019 at 14:05 VictorVictor 7623 gold badges15 silver badges33 bronze badges2 Answers
Reset to default 5Try .trigger
with altKey:true
(for pressing down alt
) and keyCode: 121
for the F10 key:
cy.get('body').trigger('keydown', { altKey: true, keyCode: 121, which: 121 })
I think you want to read the documentation on Key Combinations
I can't test it right now but I suppose following code could work:
cy.get('input').type('{alt}', { release: false }) // this should keep alt pressed
cy.get('input').trigger('keydown', { keyCode: 121, which: 121 }) // trigger F10 keycode
Anyway, read the documentation about { release: false })
option of .type
, you should find your answer there.
Note: You cannot type F10 using {f10} because it's not built in Cypress yet. The special characters which are built in are described HERE.
本文标签: javascriptCypress type combination of keys and keyCodesStack Overflow
版权声明:本文标题:javascript - Cypress: type combination of keys and keyCodes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744037888a2580116.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论