2020-11-30 15:16 阅读 4


Added the Capybara.keydown function to the capybara.js file, allowing you to do find(field).base.invoke('keydown', false, false, false, false, keyCode, charCode)


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39622332 weixin_39622332 2020-11-30 15:16

    Thanks for the patch, but we don't merge anything in without tests.

    Also, I think this would be much more useful if it had a corresponding method on Ruby Node objects to issue these commands. That way you could find an element and issue keydown events.

    点赞 评论 复制链接分享
  • weixin_39732991 weixin_39732991 2020-11-30 15:16

    None of the other events have tests as far as I can tell, and if they do let me know where and I will write tests for the one I added. Also, I agree that it probably would be useful to have methods on Node for these events, however that was not the purpose of this addition, merely to add the keydown functionality. I will look at adding that later though.

    点赞 评论 复制链接分享
  • weixin_39622332 weixin_39622332 2020-11-30 15:16

    Tests for all the functionality in capybara.js is in spec/driver_spec.rb. Anything in capybara.js just serves as an implementation to the Ruby API. I think this functionality would be useful, but I'm not willing to accept a pull request that adds unexposed functionality to capybara.js, since it's supposed to be internal.

    点赞 评论 复制链接分享
  • weixin_39622332 weixin_39622332 2020-11-30 15:16

    Those events are all invoked through the capybara interface. Calling methods on capybara nodes like click and set invoke the appropriate functions in Javascript. There isn't any functionality in capybara.js that you can't get to using Ruby methods on the driver and nodes.

    点赞 评论 复制链接分享