我正在使用以AppleScript创建的以下应用来处理Firefox中的授权凭据
on run ARGV
delay 10
tell application "plugin-container"
activate
end tell
tell application "System Events"
if UI elements enabled then
tell process "Firefox"
set frontmost to true
end tell
if length of ARGV < 2 then
display dialog "Usage: FileName UserName Password"
return
end if
keystroke item 1 of ARGV
keystroke tab
keystroke item 2 of ARGV
keystroke return
else
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
display dialog "UI element scripting is not enabled. Check \"Enable access for assistive devices\""
end tell
end if
end tell
end run
使用以下selenium代码在我的selenium代码中调用应用程序
String[] dialog = new String[]{ "src/test/resources/AuthenticationFF.app","UserName","Password" };
//First String in the application name. Must be in your project folder.
// Second is UserName to log in
// Third is Password.
Runtime.getRuntime().exec(dialog);
问题是,我在尝试访问应用时遇到以下错误:
无法运行程序&#34; src / test / resources / FF.app&#34;:错误= 13,权限被拒绝
请指教。非常感谢
答案 0 :(得分:0)
我通过将应用路径更改为 src / test / resources / AuthenticationFF.app / Contents / MacOS / applet 来修复了权限被拒绝错误,现在我必须重新访问applescript,因为它没有插入验证框上的用户+密码。