반응형 Python11 python selenium pyqt5 창닫힘 이벤트 추가 #pyqt5 창닫힘 이벤트 추가 def closeEvent(self, event): reply = QMessageBox.question(self, '확인', '프로그램을 종료하시겠습니까?', QMessageBox.Yes | QMessageBox.No, QMessageBox.No) if reply == QMessageBox.Yes: driver.quit() event.accept() app.quit() else: event.ignore() 2023. 12. 8. python selenium 서버 시간 가져오기 & timer def showtime(self): # 서버의 현재 시간을 가져오는 함수 def get_server_time(): try: response = requests.get('서버 주소') # 서버의 URL로 변경 server_time_str = response.headers['Date'] server_time_utc = time.mktime(time.strptime(server_time_str, '%a, %d %b %Y %H:%M:%S %Z')) server_time_kst = server_time_utc + (9 * 3600) # UTC에서 KST로 변환 (9시간 추가) return server_time_kst except Exception as e: print(f'Error getting server ti.. 2023. 11. 30. Python Pyqt5 입려값 json 파일로 저장, 불러오기, 수정, 삭제 class WindowClass(QDialog, form_class) : def __init__(self) : super().__init__() self.setupUi(self) self.user_info_list = [ {'이름': '', '아이디': '', '비밀번호': '', '계정번호': ''} # 원하는 만큼 계속 추가 가능 ] def populate_user_info(self): # 선택한 이름에 해당하는 정보로 라인 에디트 업데이트 selected_name = self.combo_box1_6.currentText() user_info = next((info for info in self.user_info_list if info['이름'] == selected_name), {}) self.na.. 2023. 11. 29. python3 captcha(자동입력방지) 자동화 방법 captcha 학습 및 프로그램 적용방법 1. 학습필요한 captcha 이미지 수집 및 라벨링 2. 전처리 테스트로 최적의 이미지를 도출한다.(OpenCV CAPTCHA.py) 2. 전처리한 이미지 저장 (OpenCV CAPTCHA save.py) 3. 전처리한 이미지 글자별로 자르고 저장 (OpenCV CAPTCHA cut.py) 4. 잘라진 이미지 숫자(문자) 해당하는 폴더생성하고, 동일한 숫자(문자) 한 폴더에 모아준다. 5 학습을 진행한다. (scikit-learn train cross_val_score.py) 6. 학습된 결과를 검증한다. (scikit-learn tests folder cross_val_score.py) # 학습은 잘려진 개별 숫자(문자)이고, 검증할 샘플은 원본이기 때문에 3.. 2023. 11. 26. python3 selenium 브라우저 팝업,탭 이동 # 현재 창 핸들 저장 (처음 창) first_window_handle = driver.window_handles[0] # 새로 열린 탭의 핸들 얻기 new_window_handle = driver.window_handles[1] # 새로 열린 탭으로 전환 driver.switch_to.window(new_window_handle) # 다시 첫 번째 탭으로 전환 driver.switch_to.window(first_window_handle) # 현재 창 핸들 저장 (처음 창) first_window_handle = driver.window_handles[0] # 모든 창 핸들 가져오기 all_window_handles = driver.window_handles # 팝업 창 핸들 찾기 (예: 두 번째 창).. 2023. 11. 19. 이전 1 2 다음 반응형