I’m currently producing a program that automatically logs in by accessing a specific site using Python. When I used selenium only on the site itself during production, I saw the console because the Chrome closed automatically, but there was no error, so I thought that the site closed the Chrome, so I used the undetected_chromedriver. An error occurred in the process and I’m posting something
import time
import pyperclip
import undetected_chromedriver as uc
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver import ActionChains, Keys
from selenium.webdriver.common.by import By
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.alert import Alert
from webdriver_manager.chrome import ChromeDriverManager
class LoginService():
def __init__(self):
self.driver = None
def open_web_mode(self):
self.driver = uc.Chrome()
self.driver.set_page_load_timeout(10)
def close_browser(self):
if self.driver:
self.driver.quit()
self.driver = None
def login(self):
browser = self.driver.get("https://www.kftcvan.or.kr/member/login/form.do#")
time.sleep(2)
Alert(self.driver).dismiss()
if __name__ == "__main__":
Login = LoginService()
Login.open_web_mode()
Login.login()
time.sleep(5)
Login.close_browser()
This is my code
Exception ignored in: <function Chrome.__del__ at 0x0000016EF99FD6C0>
Traceback (most recent call last):
File "C:Userswonkyanaconda3Libsite-packagesundetected_chromedriver__init__.py", line 846, in __del__
self.quit()
File "C:Userswonkyanaconda3Libsite-packagesundetected_chromedriver__init__.py", line 801, in quit
time.sleep(0.1)
OSError: [WinError 6] Handle is invalid
This is an error code
New contributor
hi1207 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.