最终目标是用Ruby/Cucumber编写一个自动化测试,用于连接到WebDAV服务器,并在Mac中测试身份验证、CRUD和负载/性能。
我试图尽可能多地模拟用户行为,这就是为什么我在考虑rb-appscript,但我对其他想法持开放态度。
我最初尝试这样做:
app("Finder").open_location("http://example.com/dav")但这只会打开你的默认浏览器。我猜open_location只是基于协议或扩展使用Mac的默认应用程序。
我还试图模拟Finder键盘快捷键“连接到服务器...”,但也不起作用:
app("System Events").processes["Finder"].menu_bars[1].menu_bar_items["Go"].menus["Go"].menu_items["Connect to Server..."].click有什么想法吗?
发布于 2011-12-29 17:03:20
您的第二个解决方案应该工作得很好,但请替换“连接到服务器...”使用“连接到服务器…”。这是省略号字符(选项-;),而不是一行中的三个句点。
require 'appscript'
include Appscript
app('Finder').activate
# This is a slightly terser way of doing it :)
# app('System Events').processes['Finder'].menu_bars[1].menus['Go'].menu_items['Connect to Server…'].click
app("System Events").processes["Finder"].menu_bars[1].menu_bar_items["Go"].menus["Go"].menu_items["Connect to Server…"].clickhttps://stackoverflow.com/questions/8651288
复制相似问题