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:
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 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.
Is there any way to do this?
Any pointers appreciated.
-Denali
Edit: 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:
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).
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With