如何使用 rb-appscript 驱动 Mac OS Finder 的“连接到服务器”功能菜单项
最终目标是用 Ruby/Cucumber 编写一个自动化测试,用于连接到 WebDAV 服务器并测试 Mac OS X 中的身份验证、CRUD 和负载/性能。
我试图尽可能地模拟用户行为,这就是为什么我'我正在查看 rb-appscript,但我对其他想法持开放态度。
我最初尝试过这个:
app("Finder").open_location("http://example.com/dav")
但这只会打开您的默认浏览器。我猜测 open_location
只是使用 Mac OS 基于协议或扩展的默认应用程序。
我还尝试模拟“连接到服务器...”的 Finder 键盘快捷键,但这也不起作用:
app("System Events").processes["Finder"].menu_bars[1].menu_bar_items["Go"].menus["Go"].menu_items["Connect to Server..."].click
有什么想法吗?
The end goal is to write an automated test in Ruby/Cucumber for connecting to a WebDAV server and testing authentication, CRUD and load/performance in Mac OS X.
I'm trying to simulate user behavior as much as possible which is why I'm looking at rb-appscript, but I'm open to other ideas.
I initially tried this:
app("Finder").open_location("http://example.com/dav")
but that just opens your default browser. I'm guessing open_location
just uses Mac OS' default app based on protocol or extention.
I also tried to simulate a Finder Keyboard shortcut for "Connect to Server...", but that didn't work either:
app("System Events").processes["Finder"].menu_bars[1].menu_bar_items["Go"].menus["Go"].menu_items["Connect to Server..."].click
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的第二个解决方案应该可以正常工作,但请将“连接到服务器...”替换为“连接到服务器...”。这是省略号字符(选项-;),而不是连续的三个句点。
Your second solution should work just fine, but replace the "Connect to Server..." with "Connect to Server…". That's the ellipsis character (option-;), not three periods in a row.