如何在Asp.net Web应用程序中模拟鼠标左键和右键单击

发布于 2024-09-24 01:34:39 字数 126 浏览 3 评论 0原文

如何在 Asp.net Web 应用程序中模拟鼠标左键和右键单击?

我找到了一个关于 win 应用程序问题的线程,但不适用于网络应用程序...

在鼠标右键模拟中我想看到菜单栏...

提前致谢

How can i Simulate Left And Right Mouse Click In Asp.net Web Applications ?

i found a thread about this issue for win applications but not work on web app...

in right mouse simulation i want to see menu bar...

thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

又怨 2024-10-01 01:34:39

您可以通过引发要模拟单击的控件的 Clicked 事件,以编程方式在服务器端模拟鼠标左键单击的结果。

右键单击本身不会通过回发发送到服务器。它们纯粹在浏览器的范围内处理,尽管操作可以通过 JavaScript 与右键单击绑定,但出于充分的理由,此类代码无法从浏览器外部以编程方式访问。同样,OnClick JavaScript 事件只能通过用户操作调用(直接单击该按钮或根据其他用户操作调用相同的方法)。

如果您想模拟用户体验进行测试,我会研究 UI 自动化设置,例如 Selenium 或 iMacro。

You can simulate the results of a left mouse click programatically on the server side by raising the Clicked event of the control you want to simulate the click on.

Right-clicks in and of themselves are not sent to the server via postback. They are handled purely within the confines of the browser, and though actions can be tied to a right-click via JavaScript, such code is, for very good reason, not accessible programatically from outside the browser. Similarly, OnClick JavaScript events can be invoked only through user action (either directly clicking on that button or by calling the same method based on some other user action).

If you want to simulate a user experience for testing, I'd look into a UI automation setup like Selenium or iMacro.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文