Java MacOS Catalina(v 10.15.3):错误:“chromedriver”无法打开,因为无法验证开发者。无法启动 Chrome 浏览器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/60362018/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 01:21:35  来源:igfitidea点击:

MacOS Catalina(v 10.15.3): Error: “chromedriver” cannot be opened because the developer cannot be verified. Unable to launch the chrome browser

javamacosselenium

提问by Venkatesh G

I have recently upgraded my mac machine to OS Catalina(v 10.15.3). After this upgrade I am unable to launch the chrome driver using selenium.

我最近将我的 mac 机器升级到 OS Catalina(v 10.15.3)。升级后,我无法使用 selenium 启动 chrome 驱动程序。

I am facing the below error when I run the selenium code to launch the chrome browser.

当我运行 selenium 代码来启动 chrome 浏览器时,我面临以下错误。

"“chromedriver” cannot be opened because the developer cannot be verified". "macOS cannot verify that this app is free from malware."

“无法打开“chromedriver”,因为无法验证开发人员”。“macOS 无法验证此应用程序是否没有恶意软件。”

Please help me!

请帮我!

采纳答案by Venkatesh G

I found the work around as below

我发现解决方法如下

  1. Open terminal
  2. Navigate to path where your chromedriver file is located
  3. Execute any one of the below commands
  1. 打开终端
  2. 导航到 chromedriver 文件所在的路径
  3. 执行以下任一命令

Command1:xattr -d com.apple.quarantine <name-of-executable>

命令 1:xattr -d com.apple.quarantine <name-of-executable>

Example

例子

/usr/local/Caskroom/chromedriver/80.0.3987.106 
$ xattr -d com.apple.quarantine chromedriver 

(or)

(或者)

Command2:spctl --add --label 'Approved' <name-of-executable>

命令 2:spctl --add --label 'Approved' <name-of-executable>

Source: https://docwhat.org/upgrading-to-catalina

来源:https: //docwhat.org/upgrading-to-catalina

Note: This will work only with the file(s) where the above command is executed. If a new chromedriver is downloaded then the command has to be executed again on the newly downloaded file

注意:这仅适用于执行上述命令的文件。如果下载了新的 chromedriver,则必须在新下载的文件上再次执行该命令

回答by Amit Jain

In macOS Catalina and macOS Mojave, when an app fails to install because it hasn't been notarized or is from an unidentified developer, it will appear in System Preferences > Security & Privacy, under the General tab. Click Open Anyway to confirm your intent to open or install the app.

在 macOS Catalina 和 macOS Mojave 中,当应用程序由于未经公证或来自身份不明的开发者而无法安装时,它会出现在“系统偏好设置”>“安全性和隐私”中的“常规”选项卡下。单击仍然打开以确认您打算打开或安装该应用程序。

enter image description here

在此处输入图片说明

The warning prompt reappears, and you can click Open.*

再次出现警告提示,您可以点击打开。*

enter image description here

在此处输入图片说明

The app is now saved as an exception to your security settings, and you can open it in the future by double-clicking it, just as you can any authorized app.

该应用程序现在已保存为您的安全设置的例外,您可以在将来通过双击它来打开它,就像您可以打开任何已授权的应用程序一样。

*If you're prompted to open Finder: control-click the app in Finder, choose Open from the menu, and then click Open in the dialog that appears. Enter your admin name and password to open the app.

*如果系统提示您打开 Finder:按住 Control 键点按 Finder 中的应用程序,从菜单中选择“打开”,然后在出现的对话框中点按“打开”。输入您的管理员名称和密码以打开应用程序。

回答by Slipstream

Quick solution

快速解决方案

  1. Open Finder
  2. Navigate to where the chromedriver file is located
  3. Right-click on the chromedriver file and select open
  1. 打开查找器
  2. 导航到 chromedriver 文件所在的位置
  3. 右键单击 chromedriver 文件并选择打开

After this the script should work fine.

在此之后,脚本应该可以正常工作。

回答by S Sen

Open terminal and navigate to path where chromedriver is downloaded. Execute xattr -d com.apple.quarantine chromedriver

打开终端并导航到下载 chromedriver 的路径。执行xattr -d com.apple.quarantine chromedriver