Selenium issues with Chrome.exe and Chromedriver.exe

Registered Posts: 5 ✭✭

I get this error

Chrome binary found at: C:\\Program Files\\Google\\Chrome\\Application\\chrome.exeExecute permission
for C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe is granted.
Failed to launch Chrome binary at C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe: /bin/sh: 
C:\Program Files\Google\Chrome\Application\chrome.exe: command not foundRead permission for 
C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe is granted.Write permission for 
C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe is granted.

for this code

import os
import subprocess

Path to the Chrome binary

chrome_path = r"C:\Program Files\Google\Chrome\Application\chrome.exe"

Check if the Chrome binary exists at the specified path

if os.path.exists(chrome_path):
print(f"Chrome binary found at: {chrome_path}")
else:
print(f"Chrome binary not found at: {chrome_path}")

Check execute permission

if os.access(chrome_path, os.X_OK):
print(f"Execute permission for {chrome_path} is granted.")
# Verify that the Chrome binary can be executed
try:
result = subprocess.run(f'"{chrome_path}"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if result.returncode == 0:
print(f"Chrome binary at {chrome_path} launched successfully.")
else:
print(f"Failed to launch Chrome binary at {chrome_path}: {result.stderr.decode()}")
except FileNotFoundError:
print(f"Chrome binary not found at {chrome_path}.")
except PermissionError:
print(f"Permission denied to execute Chrome binary at {chrome_path}.")
except Exception as e:
print(f"Failed to launch Chrome binary at {chrome_path}: {e}")
else:
print(f"Execute permission for {chrome_path} is denied.")

Check read and write permissions

try:
with open(chrome_path, 'r'):
print(f"Read permission for {chrome_path} is granted.")
except PermissionError:
print(f"Read permission for {chrome_path} is denied.")
except Exception as e:
print(f"Error checking read permission for {chrome_path}: {e}")

try:
with open(chrome_path, 'a'):
print(f"Write permission for {chrome_path} is granted.")
except PermissionError:
print(f"Write permission for {chrome_path} is denied.")
except Exception as e:
print(f"Error checking write permission for {chrome_path}: {e}")

Operating system used: windows

Operating system used: windows

Operating system used: windows

Welcome!

It looks like you're new here. Sign in or register to get started.

Answers

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.