0

I have read many answers and tried adding options and binary location but to no avail. (I have many chrome profiles, I created a new chrome profile and identified it as profile 8.) I downloaded chromedriver last night so assume that is up to date and my chrome is up to date.

Error: selenium.common.exceptions.WebDriverException: Message: unknown error: Devtools port number file contents <62045> were in an unexpected format

MY CODE:

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

chrome_driver_path = "C:\Development\chromedriver.exe"
options = Options()
options.binary_location = "C:\\Users\\Owner\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"
options.add_argument("user-data-dir=C:\\Users\\Owner\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 8")
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--start-maximized")
driver = webdriver.Chrome(executable_path=chrome_driver_path, options=options)


driver.get(url="https://www.google.com")

driver.quit()

DESIRED OUTPUT: I want to successfully launch chrome and practice with selenium :)

Brisco
  • 99
  • 9
  • Does this answer your question? [Chromedriver Devtools port number error](https://stackoverflow.com/questions/50854859/chromedriver-devtools-port-number-error) – cruisepandey Aug 25 '21 at 08:59
  • Use the compatible chromedriver – cruisepandey Aug 25 '21 at 09:00
  • I have tried two verions of chromedriver. (My chrome says: "Google Chrome is up to date Version 92.0.4515.159 (Official Build) (64-bit)" and I have tried chromedriver "ChromeDriver 92.0.4515.107" and "ChromeDriver 93.0.4577.15" to no avail. – Brisco Aug 25 '21 at 09:23

1 Answers1

0

The below worked for me, I think that my binary location was wrong, it was not pointing to the path of Program Files.

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

chrome_driver_path = r"C:\Development\chromedriver.exe"
options = Options()
options.binary_location = r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
options.add_argument("--start-maximized")
driver = webdriver.Chrome(executable_path=chrome_driver_path, options=options)


driver.get(url="https://www.bbc.co.uk")
time.sleep(2)
driver.quit()
Brisco
  • 99
  • 9