3

I'm trying use Selenium to open chrome using a specific profile. I located the profile location in chrome://version and used the following code:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument(
    "user-data-dir=../../Library/Application Support/Google/Chrome/Profile 2/")
driver = webdriver.Chrome(
    executable_path='./chromedriver', options=options)
driver.get("https://google.com")

But instead, it throws this error:

Traceback (most recent call last):
  File "select_files.py", line 10, in <module>
    driver = webdriver.Chrome(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot parse internal JSON template: Line: 1, column: 1, Unexpected token.

I tried using without the /profile 2/ but it still comes up with this error

I am using Python 3, Selenium 1.25.9, Chrome Version 85.0.4183.83, Chrome Driver MacOS Catalina

  • same question here – myworldbox May 16 '21 at 07:51
  • This is not a duplicated question, as it is specific for mac. I have looked at all the other stackoverflow and youtube solutions, and they are all for windows, and didn't work for my mac. Please reopen it – alson_y Feb 17 '23 at 05:33

0 Answers0