Программа работает, но выскакивает ошибка

Рейтинг: 0Ответов: 1Опубликовано: 01.04.2023

Написал небольшую программу на Selenium. При запуске в PyCharm ошибка не выскакивает, но при запуске в cmd выскакивает ошибка. При этом программа работает как надо.

Ошибка:

DevTools listening on ws://127.0.0.1:59664/devtools/browser/d0818b3f-1a0c-48ba-9b9b-d9580092c9a7
[0401/010743.185:INFO:CONSOLE(1)] "[object Response]", source: https://testnet.caldera.dev/_next/static/chunks/pages/index-9bbf216c68946470.js (1)
[0401/010743.185:INFO:CONSOLE(1)] "is loaded!", source: https://testnet.caldera.dev/_next/static/chunks/pages/index-9bbf216c68946470.js (1)
[0401/010743.385:INFO:CONSOLE(1)] "[object Response]", source: https://testnet.caldera.dev/_next/static/chunks/pages/index-9bbf216c68946470.js (1)
[0401/010743.385:INFO:CONSOLE(1)] "is loaded!", source: https://testnet.caldera.dev/_next/static/chunks/pages/index-9bbf216c68946470.js (1)
[0401/010743.798:INFO:CONSOLE(64)] "Uncaught TypeError: Cannot read properties of null (reading 'style')", source: https://eth-goerli-testnet.calderaexplorer.xyz/ (64)
[0401/010744.649:INFO:CONSOLE(64)] "Uncaught TypeError: Cannot read properties of null (reading 'style')", source: https://usdc-polygon-testnet.calderaexplorer.xyz/ (64)
[0401/010747.778:INFO:CONSOLE(0)] "The resource https://eth-goerli-testnet.calderaexplorer.xyz/images/icons/fontawesome/github-085f3d7cc061791dbc3091dd891324d0.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://eth-goerli-testnet.calderaexplorer.xyz/ (0)
[0401/010747.778:INFO:CONSOLE(0)] "The resource https://eth-goerli-testnet.calderaexplorer.xyz/images/icons/fontawesome/tag-287add6175476b8324518840bd775fc4.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://eth-goerli-testnet.calderaexplorer.xyz/ (0)
[0401/010747.779:INFO:CONSOLE(0)] "The resource https://eth-goerli-testnet.calderaexplorer.xyz/images/icons/fontawesome/bar-chart-695c0e001e45371bc2aa623682ee28b4.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://eth-goerli-testnet.calderaexplorer.xyz/ (0)
[0401/010747.779:INFO:CONSOLE(0)] "The resource https://eth-goerli-testnet.calderaexplorer.xyz/images/icons/fontawesome/twitter-77c54a1c1b6059dd7d457930bc8d1671.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://eth-goerli-testnet.calderaexplorer.xyz/ (0)
[0401/010747.779:INFO:CONSOLE(0)] "The resource https://eth-goerli-testnet.calderaexplorer.xyz/images/icons/fontawesome/telegram-b3bc7d8aac69fc737afcd163f23c5dd3.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://eth-goerli-testnet.calderaexplorer.xyz/ (0)
[0401/010747.779:INFO:CONSOLE(0)] "The resource https://eth-goerli-testnet.calderaexplorer.xyz/images/icons/fontawesome/info-circle-cc526228a68f0cd74fa6c80b8924d54f.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://eth-goerli-testnet.calderaexplorer.xyz/ (0)
[0401/010748.385:INFO:CONSOLE(0)] "The resource https://usdc-polygon-testnet.calderaexplorer.xyz/images/icons/fontawesome/info-circle-cc526228a68f0cd74fa6c80b8924d54f.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://usdc-polygon-testnet.calderaexplorer.xyz/ (0)
[0401/010748.386:INFO:CONSOLE(0)] "The resource https://usdc-polygon-testnet.calderaexplorer.xyz/images/icons/fontawesome/twitter-77c54a1c1b6059dd7d457930bc8d1671.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://usdc-polygon-testnet.calderaexplorer.xyz/ (0)
[0401/010748.386:INFO:CONSOLE(0)] "The resource https://usdc-polygon-testnet.calderaexplorer.xyz/images/icons/fontawesome/github-085f3d7cc061791dbc3091dd891324d0.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://usdc-polygon-testnet.calderaexplorer.xyz/ (0)
[0401/010748.386:INFO:CONSOLE(0)] "The resource https://usdc-polygon-testnet.calderaexplorer.xyz/images/icons/fontawesome/bar-chart-695c0e001e45371bc2aa623682ee28b4.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://usdc-polygon-testnet.calderaexplorer.xyz/ (0)
[0401/010748.386:INFO:CONSOLE(0)] "The resource https://usdc-polygon-testnet.calderaexplorer.xyz/images/icons/fontawesome/telegram-b3bc7d8aac69fc737afcd163f23c5dd3.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://usdc-polygon-testnet.calderaexplorer.xyz/ (0)
[0401/010748.387:INFO:CONSOLE(0)] "The resource https://usdc-polygon-testnet.calderaexplorer.xyz/images/icons/fontawesome/tag-287add6175476b8324518840bd775fc4.svg?vsn=d was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally.", source: https://usdc-polygon-testnet.calderaexplorer.xyz/ (0)
Успешно отправлено

Как мне это исправить?

Код программы:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from art import *

chrome_options = Options()
chrome_options.add_argument("--headless")

while True:
    driver = webdriver.Chrome(options=chrome_options)
    driver.get("https://testnet.caldera.dev/")
    driver.find_element(By.XPATH, "//button[contains(text(),'Request faucet funds')]").click()
    driver.find_element(By.XPATH, "//*[@id='address']").send_keys("0x0000000000000000000000000000000000000000")
    driver.find_element(By.XPATH, "//button[contains(text(),'Receive Funds')]").click()
    try:
        popup_message = WebDriverWait(driver, 10).until(EC.text_to_be_present_in_element((By.CLASS_NAME, "go3958317564"), "Funds sent to your address!"))
        if popup_message:
            print("Успешно отправлено")
    except:
        print("Не найдено")
    driver.quit()

Ответы

▲ 1Принят

Это не ошибка, а информационное сообщение. Вы можете регулировать уровень логирования селениум с помощью доп параметра options

chrome_options.add_argument("--log-level=3")

Уровни логирования в селениум:

название идентификатор
INFO 0
WARNING 1
LOG_ERROR 2
LOG_FATAL 3