YUI测试:如何用JavaScript模拟更复杂的用户操作?
我有很多用 YUI Test 编写的测试。 YUI 测试在模拟用户操作方面的能力非常有限,或者说水平相当低。例如,我无法轻松模拟用户在文本字段中键入内容以及随之而来的 DOM 对象的事件和修改。
Selenium 在这方面做得更好,但 Selenium 的运行方式不同。 Selenium 或其他库中是否有代码可以调用来模拟用户的操作,例如“在此按钮中键入此文本”,并且仍将我的测试保留为 YUI 测试?
I have a number of tests written with YUI Test. YUI Test capabilities when it comes to simulating users' actions are quite limited, or rather fairly low level. For instance, I can't easily simulate the user typing in a text field, with the events and modifications to DOM objects that go with it.
This is something that Selenium does much better, but Selenium is ran in a different way. Is there code in Selenium or some other library that I could call to simulate users' actions, like "type this text in this button", and still keep my test as a YUI Test?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为你能够将它们保留为 YUI 测试。您可以以某种方式在测试中导入 selenium 的 js 库,并调用 browserbot 中的方法来执行您所说的复杂操作,但我更愿意保持清晰并正确创建一个 selenium 测试套件。
I don't think you'll be able to keep them as YUI tests. You could somehow import selenium's js libs in your tests and call the methods in browserbot to make those complex actions you say, but I'd prefer to keep things clear and create a selenium test suite properly.