Selenium Webdriver
Verfasst: Mittwoch 20. September 2023, 18:43
Hey,
und jedesmal:
Code: Alles auswählen
import os
import platform
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.options import Options
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
# Informiere Benutzer über erforderliche Pakete
required_packages = ['selenium', 'webdriver-manager']
for package in required_packages:
try:
__import__(package)
except ImportError:
print(f"Bitte installiere das Paket {package} mit 'pip install {package}'")
# Automatische Erkennung des Betriebssystems
system = platform.system()
if system == "Windows":
url = "https://support.microsoft.com/en-us/windows/what-s-new-in-recent-windows-updates-2df971e0-341a-68b1-3bf8-bc3e3ff8c3a5"
elif system == "Linux":
url = "https://bits.debian.org/"
else:
print("Dieses Betriebssystem wird nicht unterstützt.")
# Chrome-Optionen konfigurieren
chrome_options = Options()
chrome_options.headless = True
# WebDriver initialisieren
driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=chrome_options)
und/bin/sh: 1: google-chrome: not found
/bin/sh: 1: google-chrome-stable: not found
/bin/sh: 1: google-chrome-beta: not found
/bin/sh: 1: google-chrome-dev: not found
/bin/sh: 1: google-chrome: not found
/bin/sh: 1: google-chrome-stable: not found
/bin/sh: 1: google-chrome-beta: not found
/bin/sh: 1: google-chrome-dev: not found
/bin/sh: 1: google-chrome: not found
/bin/sh: 1: google-chrome-stable: not found
/bin/sh: 1: google-chrome-beta: not found
/bin/sh: 1: google-chrome-dev: not found
/bin/sh: 1: google-chrome: not found
/bin/sh: 1: google-chrome-stable: not found
/bin/sh: 1: google-chrome-beta: not found
/bin/sh: 1: google-chrome-dev: not found
/bin/sh: 1: google-chrome: not found
/bin/sh: 1: google-chrome-stable: not found
/bin/sh: 1: google-chrome-beta: not found
/bin/sh: 1: google-chrome-dev: not found
Wenn jemand Ahnung hat bitte melden. DankeException has occurred: TypeError
__init__() got an unexpected keyword argument 'chrome_options'
File "/home/pasdadas/drive.py", line 35, in <module>
driver = webdriver.Chrome(ChromeDriverManager().install(), chrome_options=chrome_options)
TypeError: __init__() got an unexpected keyword argument 'chrome_options'