【发布时间】:2022-01-23 09:26:16
【问题描述】:
我正在尝试关闭浏览器并在循环后重新打开它
class Bot():
driver = webdriver.Chrome(options=chrome_options)
def __init__(self):
self.openyoutube
self.quitbrowser()
def openyoutube(self):
self.driver.get('https://www.youtube.com')
sleep(5)
def quitbrowser(self):
self.driver.quit()
def main():
while True:
my_bot = Bot()
sleep(15)
if __name__ == '__main__':
main()
但是一旦它试图重新开始,它就会抛出这个错误:
raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', 端口 = 64578):最大重试次数超出 url: /session/f7fcdfe14c3e2c75d530b3cbf70348d2/url(由 NewConnectionError('
:无法建立新连接:[Errno 61] 连接被拒绝'))
【问题讨论】:
标签: python selenium selenium-webdriver selenium-chromedriver