我尝试编写一个简单的脚本,每小时检查一次网站,并在发现有空时向我发送电子邮件。
我认为每隔一小时执行此操作不会引发任何问题,但出现以下错误:
MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=60745): Max retries exceeded with url: /session/900f45d6c8c800f2a8ebcf43daa05b69/url (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa42c261c10>: Failed to establish a new connection: [Errno 61] Connection refused'))
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
import schedule
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from notification import *
#script i have to send an email (works fine)
PATH = "mypath"
# i have the path where there drivers are
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--window-size=1920x1080")
# to not open the browser
driver = webdriver.Chrome(options=chrome_options, executable_path=PATH) …Run Code Online (Sandbox Code Playgroud) python selenium google-chrome httpconnection selenium-chromedriver