简体   繁体   English

使用Test Studio创建HTML画布自动化测试

[英]Creating html canvas automation tests with Test Studio

I am currently investigating Telerik Test Studio to generate automated tests and I have been trying to figure out a way to create automated tests for our application that uses a GoJS html 5 canvas. 我目前正在研究Telerik Test Studio以生成自动化测试,并且我一直在尝试寻找一种为使用GoJS html 5 canvas的应用程序创建自动化测试的方法。 I have noticed two ways so far: 到目前为止,我已经注意到了两种方法:

  1. Click on specific points (ActiveBrowser.Desktop.Mouse.Click(MouseClickType.LeftClick, 930, 405);). 单击特定的点(ActiveBrowser.Desktop.Mouse.Click(MouseClickType.LeftClick,930,405);)。 This seems to work provided that the browser always opens in full screen and that the elements in the canvas never change meaning that the tests might become obsolete so I don't believe it being the best approach. 如果浏览器始终在全屏模式下打开,并且画布中的元素永不更改,则这似乎可行,这意味着测试可能会过时,因此我认为这不是最好的方法。
  2. There seems to be an HtmlCanvas class that I can't seem to find much information or examples on. 似乎有一个HtmlCanvas类,我似乎找不到太多的信息或示例。 I have tried to use it as follows but it does not seem as if I can access the elements or text in the canvas this way either: 我尝试按以下方式使用它,但似乎也无法以这种方式访问​​画布中的元素或文本:

    HtmlCanvas canvas = new HtmlCanvas(ActiveBrowser.Find.AllElements().FirstOrDefault(w => w.TagName == "canvas")); HtmlCanvas canvas = new HtmlCanvas(ActiveBrowser.Find.AllElements()。FirstOrDefault(w => w.TagName ==“ canvas”));

What would be the best way to approach this scenario? 解决这种情况的最佳方法是什么? Where is a good place to find more information and examples regarding Test Studio HtmlCanvas? 在哪里可以找到有关Test Studio HtmlCanvas的更多信息和示例的好地方?

I suggest that you look at the http://gojs.net/latest/extensions/Robot.html sample, and then make use of the http://gojs.net/latest/extensions/Robot.js extension in your test system. 我建议您查看http://gojs.net/latest/extensions/Robot.html示例,然后在测试系统中使用http://gojs.net/latest/extensions/Robot.js扩展。

Note that the coordinates used by Robot are in GoJS document coordinates, not screen coordinates or any particular HTML element's coordinates. 请注意,Robot使用的坐标是GoJS文档坐标,而不是屏幕坐标或任何特定HTML元素的坐标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM