英文:
Selenium Chrome driver does not recognize certificates, but manual browsing works fine
问题
I am encountering an issue with Selenium and Chrome where the browser does not recognize certificates when using the Selenium Chrome driver.
Strangely, when I manually open Google Chrome and visit the same websites, everything works fine.
Below is the code I'm using:
from seleniumwire import webdriver
from webdriver_manager.chrome import ChromeDriverManager
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), chrome_options=chromeOptions)
driver.get("https://www.google.com")
However, when I run the code, I get the following result:
Could someone please help me understand what I might be doing wrong?
英文:
I am encountering an issue with Selenium and Chrome where the browser does not recognize certificates when using the Selenium Chrome driver.
Strangely, when I manually open Google Chrome and visit the same websites, everything works fine.
Below is the code I'm using:
from seleniumwire import webdriver
from webdriver_manager.chrome import ChromeDriverManager
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument('--ignore-certificate-errors')
driver = webdriver.Chrome(executable_path=ChromeDriverManager().install(), chrome_options=chromeOptions)
driver.get("https://www.google.com")
However, when I run the code, I get the following result:
Could someone please help me understand what I might be doing wrong?
答案1
得分: 1
Since you are using selenium wire You need to install the certificate in your local machine
You can also get the certificate by running the following command
python -m seleniumwire extractcert
or
python3 -m seleniumwire extractcert
You can also get the file from below link also just copy-paste it to a file and name it "ca.crt"
Once you have the ".crt" file downloaded you have to import the certificate.
In MAC Open Keychain Access and then import items and then import the .crt file, then search for "Selenium Wire CA" cert, double click, expand the trust section and select Always trust, after this you should not see "Not Secured" in Chrome anymore
For windows
Launch MMC (mmc.exe) -> Choose File -> Add/Remove Snap-ins -> Choose Certificates, then choose Add -> Choose My user account
-> Choose Add again and this time select Computer Account -> Move the new certificate from the Certificates-Current User -> Trusted Root Certification Authorities into Certificates (Local Computer) -> Trusted Root Certification Authorities.
英文:
Since you are using selenium wire You need to install the certificate in your local machine
You can also get the certificate by running the following command
python -m seleniumwire extractcert
or
python3 -m seleniumwire extractcert
You can also get the file from below link also jut copy paste it to a file and name it "ca.crt"
Once you have the ".crt" file downloaded you have to import the certificate.
In MAC Open Keychain Access and them import items and them import the .crt file , then search for "Selenium Wire CA" cert , double click , expand the trust section and select Always trust, after this you should not see Not Secured in chrome anymore
For windows
Launch MMC (mmc.exe) -> Choose File > Add/Remove Snap-ins -> Choose Certificates, then choose Add -> Choose My user account
-> Choose Add again and this time select Computer Account -> Move the new certificate from the Certificates-Current User -> Trusted Root Certification Authorities into Certificates (Local Computer) -> Trusted Root Certification Authorities.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论