“selectFiles”的解决方法Flash 对象上的函数调用
我更多的是一个服务器端和 JavaScript 程序员。我从来没有对 Flash 做过太多事情。
我有一个基于 flash swfuploader 的强大的 html 表单,我需要使用 Selenium 2 / WebDriver 对其进行测试。
问题是,
movieContent.CallFunction('<invoke name="selectFiles" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
Flash 10 不支持......
我们该怎么办?如果可能的话,我可以 js.executeScript(script);
但现在我必须在我的 java junit/selenium 测试中执行某种 movieContent.click()
但它不会触发选择文件窗口,它不会执行任何操作。
可以将鼠标移动到指定的坐标并使用 MoveToOffsetAction 单击,但我没有设法使用 FirefoxDriver 或 chromeDriver 2.0b3 来做到这一点...
I'm more of a server-side and javascript programmer. I have never done much with Flash.
I have a robust html form based on flash based swfuploader and I need to test it with Selenium 2 / WebDriver.
The problem is, that
movieContent.CallFunction('<invoke name="selectFiles" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
is not supported in Flash 10 ...
What are we supposed to do ? If it was possible I could js.executeScript(script);
But now I have to do some sort of movieContent.click()
in my java junit/selenium tests but it doesn't trigger the select file window, it doesn't do anything.
It is possible to move the mouse to specified co-ordinates and click using the MoveToOffsetAction, but I didn't manage to do that with FirefoxDriver neither chromeDriver 2.0b3 ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一项安全功能,用于防止网站访问本地客户端文件系统。文件系统只能通过堆栈跟踪中的用户交互来访问。 IE:点击鼠标。
控制鼠标也会违反安全规定。
您最好的选择是通过 onclick 事件从 flash 函数启动 selenium。
该函数首先允许您选择要上传的“测试”文件,然后让该函数触发硒测试。
This is a security feature to prevent a website from accessing the local client side file system. The file system and only be accessed with with a user interaction in the stack trace. IE: a mouse click.
Taking control of the mouse would also be a security violation.
You best bet would be to initiate selenium from the flash function with your onclick event.
This function would first allow you to select the "test" files to upload and then have the function trigger selenium tests.