test_selenium.py hinzugefügt
This commit is contained in:
24
test_selenium.py
Normal file
24
test_selenium.py
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import tempfile
|
||||||
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.chrome.options import Options
|
||||||
|
|
||||||
|
chrome_options = Options()
|
||||||
|
chrome_options.add_argument('--no-sandbox')
|
||||||
|
chrome_options.add_argument('--disable-dev-shm-usage')
|
||||||
|
chrome_options.add_argument('--window-size=1920,1200')
|
||||||
|
chrome_options.binary_location = "/usr/bin/chromium"
|
||||||
|
|
||||||
|
# TEMP DIR für User Data
|
||||||
|
user_data_dir = tempfile.mkdtemp()
|
||||||
|
chrome_options.add_argument(f'--user-data-dir={user_data_dir}')
|
||||||
|
|
||||||
|
try:
|
||||||
|
driver = webdriver.Chrome(options=chrome_options)
|
||||||
|
print("WebDriver erfolgreich gestartet!")
|
||||||
|
print("Typ:", type(driver))
|
||||||
|
print("Session ID:", driver.session_id)
|
||||||
|
driver.get("https://www.example.com")
|
||||||
|
print("Titel der Seite:", driver.title)
|
||||||
|
driver.quit()
|
||||||
|
except Exception as e:
|
||||||
|
print("Fehler beim Starten des WebDrivers:", e)
|
||||||
Reference in New Issue
Block a user