0

I wonder if there is a way to stop selenium from printing errors in the terminal. here is my code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from msedge.selenium_tools import EdgeOptions
import requests

options = EdgeOptions()
options.add_argument("headless")
options.add_argument("disable-gpu")

driver = webdriver.Edge("msedgedriver.exe")
driver.get("https://example.com/")

class App():
    def __init__(self, username="username_here", password="password_here"):
        self.username = username
        self.password = password

    def logIn():
        app = App()

        userField = driver.find_element(By.XPATH, "//input[@id='Username']")
        userField.send_keys(app.username)

        passField = driver.find_element(By.XPATH, "//input[@id='Password']")
        passField.send_keys(app.password)

        logInBtn = driver.find_element(By.XPATH, "//button[normalize-space()='Connexion']")
        logInBtn.click()

    def getEvents():
        eventTitles = driver.find_element(By.XPATH, "//div[@class='fc-content-skeleton']").text.splitlines()
        eventDataIDSElement = driver.find_elements(By.TAG_NAME, "a")
        eventDataIDS = [eventDataIDElement.get_attribute("data-id") for eventDataIDElement in eventDataIDSElement if eventDataIDElement.get_attribute("data-id") != None]
        

if __name__ == "__main__":
    App.logIn()
    App.getEvents()
    print("tasks done.")

I tried to change --log-level in the options but that didn't work.

0 Answers0