简体   繁体   English

使用C#的Flash自动化

[英]Flash automation with c#

I want to do test automation on a flash web page. 我想在Flash网页上进行自动化测试。 All i have in source is some Object tag and that's all. 我在源代码中所拥有的只是一些Object标记,仅此而已。 I can't navigate anywhere using xpath or class selector . 我无法使用xpathclass selector进行导航。

So for that I have that code: 因此,我有该代码:

ChromeOptions options = new ChromeOptions();
IWebDriver driver = new ChromeDriver(options);
driver.Manage().Window.Maximize();

driver.Url = url;

var body = driver.FindElement(By.XPath(".//body"));

Actions action = new Actions(driver);
action.MoveToElement(body, MouseXCoordinate, MouseYCoordinate).Click().Build().Perform();

I can't find any better solution. 我找不到更好的解决方案。 Can't I use anything better than this? 我能使用比这更好的东西吗? It's a bit uncomfortable to do everything using coordinates. 使用坐标进行所有操作有点不舒服。

You won't be able select any elements within Flash object using Selenium Webdriver. 您将无法使用Selenium Webdriver在Flash对象中选择任何元素。 Similar case if you have JavaScript canvas and you need to click on something inside Canvas. 如果您有JavaScript画布,并且需要在Canvas中单击某些东西,则情况类似。 All you can do is point a mouse cursor on certain coordinates, and perform click. 您所要做的就是将鼠标光标指向某些坐标,然后单击。

If you want to query objects inside Flash, learn about Ranorex. 如果要查询Flash中的对象,请了解Ranorex。 It is not cheap library though. 它虽然不是便宜的图书馆。

Another alternative to automating flash since selenium is unable is a framework/library called http://www.sikuli.org/ (i realize it isn't c# but its free...at least last time i checked). 由于硒无法运行,因此可以自动执行闪存的另一种替代方法是一个名为http://www.sikuli.org/的框架/库(我意识到它不是c#,但是它是免费的……至少在上次我检查过)。

It has been a few years since i've used sikuli but at a high level, it uses pictures/images of your UI in order to perform matches against it. 自从我使用sikuli已有好几年了,但在较高的层次上,它使用UI的图片/图像来对其进行匹配。 So you take a bunch of screenshots, use their scripting language (i believe it is python actualy) and create automation scripts in this manner. 因此,您需要截取一堆屏幕截图,使用其脚本语言(我相信实际上是python)并以这种方式创建自动化脚本。

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

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