在Mac上以静默方式安装Safari扩展程序,而无需任何用户提示 [英] Silent install for Safari extension on Mac without any user prompting

查看:277
本文介绍了在Mac上以静默方式安装Safari扩展程序,而无需任何用户提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Mac上为Safari 5设置Selenium测试.我需要事先安装Safari扩展程序,并且它必须在无提示的情况下以静默方式进行.从以前的文章中,我发现它可以通过以下方式加载浏览器:

I am setting up Selenium testing for Safari 5 on Mac. I need to install our Safari extension before hand, and it needs to happen silently and without any user prompting. From previous posts, I've found this works in that it loads the browser with the extension:

打开-a Safari okta.safariextz

open -a Safari okta.safariextz

但是它会打开浏览器,并向用户提示:确定要安装该扩展程序吗?"

But it leaves the browser opened with a prompt to the user: "Are you sure you want to install the extension?"

Selenium没有访问此提示的权限,因此无法单击安装".我需要配置Safari,以使其不提示用户安装,而仅允许安装扩展.

Selenium doesn't have access to this prompt and can't click install. I need to configure Safari such that it does not prompt the user to install, but just allows the extension to be installed.

有什么办法吗?

任何指针都表示赞赏.

-德纳利

推荐答案

可能的新方法:答案

Possible new method: The answer here might suggest (it's somewhat unclear) that, with a possible risk of messing up your future safari upgrades, you might be able to manually install an extension, skipping the confirmation prompt, via a file move and a plist hack. I haven't tried it, but it looks as if it might work:

如果您只是为内部部署而执行此操作,并且不介意Safari升级是否中断,那么您可以退出Safari,将扩展安装到〜/Library/Safari/Extensions并更新〜/Library/Safari/Extensions/Extensions.plist(格式很明显;/usr/libexec/PlistBuddy对于此类事情很有用).

If you're just doing this for in-house deployment and don't mind if it breaks on a Safari upgrade, then you can quit Safari, install the extension into ~/Library/Safari/Extensions and update ~/Library/Safari/Extensions/Extensions.plist (the format is rather obvious; /usr/libexec/PlistBuddy is useful for such things).

您不能做您想做的事-至少,用我所知道的任何命令行开关或plist hack都不行.扩展安装确认是Safari安全模型的核心部分,不容易被规避.

You can't do what you're after--at least, not with any commandline switch or plist hack that I know of. Extension install confirmation is a core part of Safari's security model, and is not easily circumvented.

相反,我会考虑使用automator(如果您不熟悉它,可以考虑Selenium,但适用于桌面应用程序等)来发送相应按钮的点击,然后分发一个可通过以下方式启动safari的automator应用程序:适当的参数,在出现扩展对话框时发送单击,然后继续运行基于Selenium(而不是基于Automator的)的自动化.首先,我将检查以下链接: 通过applescript而非"duplo legos"自动化构建器进行自动化: http://www.mactech.com/articles/mactech/Vol.21/21.06/UserInterfaceScripting/index.html 宏录制的简要概述(点击记录,发送想要的点击,点击保存,然后您可以重新执行录制的操作): http://cjrtools.org/mac/tutorials/autohowto.html

Instead, I'd consider using automator (if you're not familiar with it, think Selenium but for desktop apps, and more) to send a click on the appropriate button, and then distributing an automator app that launches safari with the appropriate parameters, sends the click when the extension dialog appears, and then goes on to run Selenium-based (rather than automator-based) automations. To get started, I'd check out the following links: Automating via applescript rather than the "duplo legos" automation builder: http://www.mactech.com/articles/mactech/Vol.21/21.06/UserInterfaceScripting/index.html Very brief overview of macro recording (you hit record, send the click you want, hit save, and you can re-execute your recorded actions): http://automator.us/leopard/features/virtual-user.html My favorite intro to automator tutorial: http://cjrtools.org/mac/tutorials/autohowto.html

这篇关于在Mac上以静默方式安装Safari扩展程序,而无需任何用户提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆