Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Behat 测试中,您有一个上下文来“显示测试场景中步骤的最后响应”。这会启动一个带有最后响应的静态 html 的浏览器窗口。但是在 mac os 上运行它会返回错误:
sh: x-www-browser: command not found
知道如何将此命令设置到特定的浏览器(例如 chrome)吗?
因此,在我的 Mac 上的终端(OSX 10.5.8)中,我输入:
open -a Firefox
和 Firefox 打开。
当我输入:
open -a opera
歌剧打开。这是你要找的吗?
如果您希望默认浏览器为您打开网页,您可以键入:
open http://foobar.com
参考更通用的解决方案。
干杯
尝试使用 osascript 命令行工具来控制浏览器的 AppleScript。man osascript
man osascript
更多信息:https ://stackoverflow.com/a/7276138