Export Website Certificate from Chrome on OSX

Sometimes there are problems to export a website certificate that is not trusted by one of the major CAs (self-signed or development certificates for example). Usually you’d open the certificate details in Chrome, then drag and drop the image icon to any folder on your computer (for example your Desktop). Then you’d double click it and import it into your keychain.

This sometimes doesn’t work as, when you’re drag&dropping the icon, the certificate does not get exported to the folder so you can’t double-click import it.

This can be worked around with this procedure found on stackoverflow: How to Export Certificate from Chrome on a Mac?

Just for future reference and in case stackoverflow ever gets deleted (which it never will!): Here is the plain text.

Edit 4/3/19: I have found a workaround. This is tested on Chrome for Mac 73.0.3686.86 64-bit, platform: macOS 10.14.4:
Open a new TextEdit document.
In TextEdit, click Format | Make Plain Text.
Arrange windows so that the TextEdit window and the Chrome window are both visible.

In Chrome, click the icon to the left of the URL in the address bar.
In the dropdown list, click Certificate.
Hold down Option and drag from the large certificate icon to the body of the TextEdit document. Note: If you did not follow the steps above in exactly the order stated, you may need to first single-click within the Chrome window so that TextEdit doesn't become hidden when you Option-click.
Save the TextEdit document with a .pem extension.
If you don't hold down Option when you drag, then you will instead get the certificate contents in human-readable form, which can also be handy.

(Edited 2/24/19: @RichardTopchiy is correct, this no longer works. Testing on Chrome 72.0.3626.119 64-bit. I don't know of any workaround at the present.)

(Edited 2/10/17: I have added a more up-to-date answer in a comment: How to Export Certificate from Chrome on a Mac?)
Click the icon to the left of the URL.
In the box that pops up, click the Connection tab.
Click the Certificate Information link.
A box pops up showing information about the certificate. Drag the large certificate icon to a Finder window. A .cer file will be created in the location you drag it to.
This is based on Chrome 42.0.2311.135 (64-bit) for Mac.