Preface
We work , Many friends use Windows System computer , But some of my friends still use apple mac The computer ,Windows The system computer will not be detailed here , Today, let's talk about using apples mac The computer encountered about using selenium The problem of . I don't say much nonsense , Follow Xiaobian to get to the point .
solve Apple mac The computer cannot be turned on ‘chromedriver’, Because you can't verify the developer
When the apple computer is installed chromedriver After driving , Use selenium Open Google browser , You will encounter the following problems , The picture is as follows :
terms of settlement :
First you need to find the installation chromedriver The absolute path of the drive
for instance , My path here is :/Users/edy/Desktop/rich/webdriver/chromedriver
What we need to do now is to bypass Apple's permission , Need to switch to chromedriver Execute under directory
First step , Open it directly pycharm Terminal , Enter the following command , And press enter
cd /Users/edy/Desktop/rich/webdriver
The second step , Continue to input the following commands at the terminal , And press enter
xattr -d com.apple.quarantine chromedriver
Next , We are pycharm Execute the following code in :
from selenium import webdriver
path = r'/Users/edy/Desktop/rich/webdriver/chromedriver'
url = 'https://www.baidu.com'
driver = webdriver.Chrome(path)
driver.get(url)
After successful operation , You'll find that , Your apple mac The computer can be used normally selenium Open Google Chrome .
If you like this article or it helps you , Remember to pay attention to Xiaobian and point a praise , If you have any questions or needs, please leave a message or send a private letter .
Python| How to install it correctly PaddleOCR