0

I am setting up Selenium testing for Safari 8 on Mac 10. I need to install our Safari driver beforehand, and it needs to happen silently and without any user prompting.

And also I manually install the safari driver, I saw below files would be changed:

after install, 3 files in ~/Library/preference has been changed.
after install, 7 files in ~/Library/Safari file has been changed
after install, login.keychain in ~/Library/Keychains file has been changed

From previous posts, I've tried these:

  1. Silent install for Safari extension on Mac without any user prompting. I found this works in that it loads the browser with the extension:

    open -a Safari SafariDriver.safariextz<br>
    

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

    Then I follow the first answer trying to do these: "install the extension into ~/Library/Safari/Extensions and update ~/Library/Safari/Extensions/Extensions.plist". Here I copy the SafariDriver.safariextz to this path: ~/Library/Safari/Extensions. Then I could not find the Extensions.plist in this path ~/Library/Safari/Extensions/. And I also could not find safari driver related change item in these files ~/Library/preference/com.apple.Safari.plist or com.apple.Safari.Extensions.plist

  2. I am unable to install my extension to safari from commandline (OS X 10.5.8 Safari 5+). I use this command from article to try, still with the user prompt:

    sudo /Applications/Safari.app/Contents/MacOS/safari /tmp/my-product/my-extension.safariextz<br><br>
    

    Could someone answer my questions here with more detail information, thanks in advance.

Community
  • 1
  • 1
clare
  • 1
  • 3

1 Answers1

0

I realize this through applescript.
1. applescript could handle prompt
tell application "Finder"
set f to POSIX file "/usr/bin/SafariDriver.safariextz"
if exists f then
ignoring application responses
tell application "Safari" to open f
end ignoring
tell application "System Events"
tell process "Safari"
set frontmost to true
repeat until (exists window 1) and subrole of window 1 is "AXDialog" --
delay 1
end repeat
click button 1 of front window -- install
end tell
end tell
end if
end tell
2, I have tried to copy related file like manually install files would be modified which are mentioned in my question. I could see the driver shows in Safar->preferency->Extesions. But I didn't not test whether or not it has been installed correctly. I found the Extensions.plist would be in different folder if the OS is different.
For I have tried two:
    1).when in Mac 10.9, it would be modify below file:
~/Library/Preferency:
com.apple.safari.plist
com.apple.finder.plist
~/Library/Safari:
Extensions/WebDriver.safariextz
Extensions/Extensions.plist
~/Library/KeyChain:
log.keychain
    2).when in Mac 10.10, it would be modify below file:
~/Library/Preferency:
com.apple.safari.plist
com.apple.finder.plist
com.apple.safari.Extension.plist
~/Library/Safari:
Extensions/WebDriver.safariextz
~/Library/KeyChain:
log.keychain

clare
  • 1
  • 3