옵션 이미지 삭제버튼 타임아웃 1차 수정
This commit is contained in:
parent
7d000d805d
commit
24d1bbb50d
|
|
@ -51236,3 +51236,23 @@ TypeError: QPushButton.setDisabled() takes exactly one argument (0 given)
|
|||
2024-10-30 12:03:58,792 - price.py:50 - default_logger - DEBUG - page객체 업데이트 : <Page url='https://www.percenty.co.kr/'>
|
||||
2024-10-30 12:04:32,204 - gui.py:943 - default_logger - DEBUG - 프로그램을 종료합니다...
|
||||
2024-10-30 12:04:32,206 - gui.py:620 - default_logger - DEBUG - Updated watermark text:
|
||||
2024-11-01 15:18:03,584 - vertexAI.py:18 - default_logger - DEBUG - GOOGLE_APPLICATION_CREDENTIALS 환경 변수를 설정: H:\py\autoTrans\leensoo1nt.json
|
||||
2024-11-01 15:18:03,584 - vertexAI.py:22 - default_logger - DEBUG - Vertex AI 모델 초기화 중...
|
||||
2024-11-01 15:18:03,624 - vertexAI.py:26 - default_logger - DEBUG - prompt.json 파일을 불러옵니다.
|
||||
2024-11-01 15:18:03,625 - vertexAI.py:46 - default_logger - DEBUG - 프롬프트 파일 경로: H:\py\autoTrans\prompt.json
|
||||
2024-11-01 15:18:03,631 - vertexAI.py:50 - default_logger - DEBUG - prompt.json 파일이 성공적으로 로드되었습니다.
|
||||
2024-11-01 15:18:03,768 - DatabaseManager.py:14 - default_logger - DEBUG - Database engine created with URL: sqlite:///H:\py\autoTrans\userDB.db
|
||||
2024-11-01 15:18:03,788 - cmb_diag.py:499 - default_logger - DEBUG - DB에서 데이터를 읽어와 테이블을 생성
|
||||
2024-11-01 15:18:03,789 - DatabaseManager.py:19 - default_logger - DEBUG - Creating a new database session.
|
||||
2024-11-01 15:18:03,814 - DatabaseManager.py:77 - default_logger - DEBUG - Fetched all results for query: SELECT id, category1, category2, category3, category4, crmobi_stage FROM categories WHERE 1=1 with params: {}, result count: 4901
|
||||
2024-11-01 15:18:03,933 - DatabaseManager.py:19 - default_logger - DEBUG - Creating a new database session.
|
||||
2024-11-01 15:18:03,934 - DatabaseManager.py:77 - default_logger - DEBUG - Fetched all results for query: SELECT stage, threshold, increment_unit, extra_cost FROM crmobi_stages with params: None, result count: 3
|
||||
2024-11-01 15:18:03,934 - cmb_diag.py:412 - default_logger - DEBUG - CrMoBi 단계 설정이 위젯에 반영되었습니다.
|
||||
2024-11-01 15:18:03,934 - cmb_diag.py:256 - default_logger - DEBUG - 1레벨 카테고리를 업데이트
|
||||
2024-11-01 15:18:03,934 - DatabaseManager.py:19 - default_logger - DEBUG - Creating a new database session.
|
||||
2024-11-01 15:18:03,937 - DatabaseManager.py:77 - default_logger - DEBUG - Fetched all results for query: SELECT DISTINCT category1 FROM categories WHERE category1 IS NOT NULL with params: None, result count: 11
|
||||
2024-11-01 15:18:03,945 - price.py:72 - default_logger - DEBUG - self.shipping_config : {'min_price_for_extra_shipping': 50000, 'thresholds': [50000, 100000, 200000], 'increment_unit': 20000, 'additional_costs': [5000, 7000, 9000]}
|
||||
2024-11-01 15:18:03,945 - price.py:74 - default_logger - DEBUG - self.margin_config : {'thresholds': [50000, 70000, 100000, 150000, 200000, 300000, 400000, 500000, 1000000], 'additional_margins': [5000, 10000, 15000, 25000, 35000, 50000, 70000, 90000, 120000]}
|
||||
2024-11-01 15:18:03,945 - price.py:76 - default_logger - DEBUG - self.optimal_price_config : {'sold_price': None, 'cost_price2X': None, 'calculated_price': None, 'lower_bound': 0.85, 'upper_bound': 1.15, 'ratios': {'sold_price': 0.5, 'cost_price2X': 0.3, 'calculated_price': 0.2}}
|
||||
2024-11-01 15:18:03,946 - gui.py:620 - default_logger - DEBUG - Updated watermark text: 혜리수샵
|
||||
2024-11-01 15:18:03,947 - gui.py:152 - default_logger - DEBUG - 로그기록이 설정되었습니다.
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ excluded_option_marker = '.bXsMpn.sc-dfauwV'
|
|||
; delete_button_selector = 'div#productMainContentContainerId div.lesrZh.sc-bYHUQc:nth-child({index}) span:has-text("삭제")'
|
||||
; delete_button_selector = 'div#productMainContentContainerId div.lesrZh.sc-bYHUQc:nth-child({index}) div.sc-igZIGL.kQDmyq'
|
||||
delete_button_selector = '.kQDmyq.sc-igZIGL'
|
||||
fallback1_delete_button_selector = '//*[@id="productMainContentContainerId"]/div[1]/div[2]/div/div/div[2]/div/div[1]/div/div/div[2]/div/div/div[5]/div[1]/div/div/ul/li[{index}]/div/div[1]/div/div[2]/div/div[2]/div[1]/div/span'
|
||||
confirm_delete_button_selector = '.ant-modal.css-1li46mu.ant-modal-confirm.ant-modal-confirm-confirm button:has-text("삭제")'
|
||||
add_button_selector2 = 'div#productMainContentContainerId div.lesrZh.sc-bYHUQc:nth-child({index}) > .sc-dRGYJT.hmQUGb'
|
||||
add_button_selector = '//*[@id="productMainContentContainerId"]/div[1]/div[2]/div/div/div[2]/div/div[1]/div/div/div[2]/div/div/div[5]/div[1]/div/div/ul/li[{index}]/div/div[1]/div/div[2]/div/div/img'
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ class LocatorManager:
|
|||
'option_box_selector': self.config.get('OptionLocators', 'option_box_selector').strip("'"),
|
||||
'excluded_option_marker': self.config.get('OptionLocators', 'excluded_option_marker').strip("'"),
|
||||
'delete_button_selector': self.config.get('OptionLocators', 'delete_button_selector').strip("'"),
|
||||
'fallback1_delete_button_selector': self.config.get('OptionLocators', 'fallback1_delete_button_selector').strip("'"),
|
||||
'confirm_delete_button_selector': self.config.get('OptionLocators', 'confirm_delete_button_selector').strip("'"),
|
||||
'add_button_selector': self.config.get('OptionLocators', 'add_button_selector').strip("'"),
|
||||
'file_upload_button_selector': self.config.get('OptionLocators', 'file_upload_button_selector').strip("'"),
|
||||
|
|
|
|||
24
option.py
24
option.py
|
|
@ -35,6 +35,7 @@ class OptionHandler:
|
|||
self.option_box_selector = self.locator_manager.get_locator('OptionLocators', 'option_box_selector')
|
||||
self.excluded_option_marker = self.locator_manager.get_locator('OptionLocators', 'excluded_option_marker')
|
||||
self.delete_button_selector = self.locator_manager.get_locator('OptionLocators', 'delete_button_selector')
|
||||
self.fallback1_delete_button_selector = self.locator_manager.get_locator('OptionLocators', 'fallback1_delete_button_selector')
|
||||
self.confirm_delete_button_selector = self.locator_manager.get_locator('OptionLocators', 'confirm_delete_button_selector')
|
||||
self.add_button_selector = self.locator_manager.get_locator('OptionLocators', 'add_button_selector')
|
||||
self.file_upload_button_selector = self.locator_manager.get_locator('OptionLocators', 'file_upload_button_selector')
|
||||
|
|
@ -206,7 +207,7 @@ class OptionHandler:
|
|||
return self.option_info
|
||||
|
||||
# 3. 가격 낮은 순 정렬 클릭
|
||||
# await self.low_order_click()
|
||||
await self.low_order_click()
|
||||
|
||||
try:
|
||||
self.logger.info(f"옵션 정보 수집")
|
||||
|
|
@ -760,10 +761,25 @@ class OptionHandler:
|
|||
if is_success_translated and os.path.exists(translated_image_path):
|
||||
# 삭제 버튼 클릭
|
||||
# delete_button = await self.page.query_selector(delete_button_selector)
|
||||
delete_button = await option_box.query_selector(".sc-igZIGL.kQDmyq")
|
||||
|
||||
|
||||
self.logger.debug(f"{index}번째 옵션의 이미지 삭제 버튼 가져오기")
|
||||
|
||||
try:
|
||||
# 기본 선택자로 삭제 버튼 찾기
|
||||
delete_button = option_box.locator(self.delete_button_selector)
|
||||
delete_button.set_timeout(5000) # 필요에 따라 타임아웃 설정
|
||||
if not await delete_button.is_visible():
|
||||
# fallback으로 재시도
|
||||
delete_button = option_box.locator(f'xpath={self.fallback1_delete_button_selector.format(index=index)}')
|
||||
delete_button.set_timeout(5000)
|
||||
|
||||
if await delete_button.is_visible():
|
||||
await delete_button.click()
|
||||
self.logger.debug(f"{index}번째 옵션의 삭제 버튼 클릭")
|
||||
except Exception as e:
|
||||
self.logger.error(f"{index}번째 옵션의 삭제 버튼을 찾는 중 오류 발생: {e}", exc_info=True)
|
||||
|
||||
|
||||
if delete_button:
|
||||
await delete_button.click()
|
||||
self.logger.debug(f"{index}번째 옵션의 이미지 삭제 버튼 클릭")
|
||||
|
|
@ -795,6 +811,8 @@ class OptionHandler:
|
|||
self.logger.debug(f"{index}번째 옵션에 이미지가 업로드되었습니다.")
|
||||
else:
|
||||
self.logger.error(f"{index}번째 옵션의 파일 입력 요소를 찾을 수 없습니다.")
|
||||
except Exception as e:
|
||||
self.logger.error(f"{index}번째 옵션 이미지 번역 중 오류 발생: {e}", exc_info=True)
|
||||
|
||||
finally:
|
||||
# 파일 사용 후 0.5초 대기하여 접근 완료 보장
|
||||
|
|
|
|||
Loading…
Reference in New Issue