Hi ,
I'm trying to run this script
I'm trying to run this script
#!/usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
import time
# Configure Chrome options (optional)
options = webdriver.ChromeOptions()
options.add_argument("--start-maximized") # Open browser maximized
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
options.add_argument("--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0")
options.add_argument("--headless") # Run in background (no GUI)
options.add_experimental_option("detach", True)
drv = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=options)But when I run it on my machine it failsError:C:\tmp>python e.py Traceback (most recent call last): File "C:\tmp\e.py", line 22, in <module> drv = webdriver.Chrome(service=Service(ChromeDriverManager().install()),options=options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 45, in __init__ super().__init__( File "C:\Python311\Lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 53, in __init__ self.service.start() File "C:\Python311\Lib\site-packages\selenium\webdriver\common\service.py", line 105, in start self._start_process(self._path) File "C:\Python311\Lib\site-packages\selenium\webdriver\common\service.py", line 206, in _start_process self.process = subprocess.Popen( ^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\subprocess.py", line 1022, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Python311\Lib\subprocess.py", line 1491, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [WinError 193] %1 is not a valid Win32 application Attempt to run thispython -c "import sys; print(sys.version);"produces this:
Output:3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] What I'm supposed to do to have it fixed? This machine has both Chrome 141.0.7390.54 (Official Build) (64-bit) and FF 140.3.0esr (32-bit)
