How do you give WWW::Mechanize::Firefox permission to launch Firefox?

别等时光非礼了梦想. 提交于 2019-12-11 03:53:58

问题


I'm on a Mac. I've got a simple Perl script that uses WWW::Mechanize::Firefox to pull up a web page.

The script works perfectly when Firefox is already open and running on my computer. Here's the line the creates the object:

my $mech = WWW::Mechanize::Firefox->new(
  launch => '/Applications/Firefox.app'
);

However, when Firefox is shutdown and I run the script, I get the following error:

exec failed: Permission denied at /Library/Perl/5.12/MozRepl/RemoteObject.pm line 463
 at /Library/Perl/5.12/MozRepl/RemoteObject.pm line 463

What do I do to give the perl script permission to launch Firefox?


回答1:


Try:

my $mech = WWW::Mechanize::Firefox->new(
  launch => '/Applications/Firefox.app/Contents/MacOS/firefox'
);

/Applications/Firefox.app is the application wrapper and is a directory that contains the various files that make up the application. The file at Contents/MacOS/firefox within the application wrapper is the main executable of the application.



来源:https://stackoverflow.com/questions/15128410/how-do-you-give-wwwmechanizefirefox-permission-to-launch-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!