modify_products 내 상품정보클릭 이벤트 예외처리

This commit is contained in:
R5600U_PC 2024-04-13 09:26:53 +09:00
parent 02d9a37be1
commit 3688938b94
2 changed files with 20 additions and 18 deletions

View File

@ -16,8 +16,8 @@ class AutoPercentyProductsDB:
'option_modification': 'incomplete',
'detail_page_modification': 'incomplete',
'thumbnail_modification': 'incomplete'
# 'thumbnail_modification': 'incomplete',
# 'price_modification': 'incomplete',
'thumbnail_modification': 'incomplete',
'price_modification': 'incomplete',
# 'title_modification': 'incomplete'
}
document = {'product_id': product_id, 'process_steps': steps, 'user': user, 'created_at': datetime.now()}

View File

@ -346,22 +346,24 @@ def modify_products(driver, gemini, translator, mongo_config, login_info, set_nu
# # product_title_element = driver.find_element(By.XPATH, (f"//div[{i}]/li/div/div/div[2]/div/div/div/div"))
# driver.execute_script("arguments[0].click();", product_title_element)# 상품 수정 페이지 자바스크립트로 열기
click_to_product_title_for_modify_xpath = f"//div[{i}]/li/div/div/div[2]/div/div/div/div"
click_element(driver, 'XPATH', click_to_product_title_for_modify_xpath, 10, 'js')
logger.debug("상품 수정 페이지 클릭")
time.sleep(0.3)
tao_title_text_xpath = "//div[@id='productMainContentContainerId']/div/div/div[6]/div/div/span"
tao_title = return_element(driver, 'XPATH', tao_title_text_xpath, 10)
logger.debug(f"tao_title 텍스트 : {tao_title.text}")
product_infos[i-1].tao_title = tao_title.text
# 상품수정 페이지에 표시된 퍼센티카테고리 텍스트 수집
per_cat = return_element(driver, 'XPATH', '//div[8]/div/div/div[2]/div/div/div/span[2]/div/div', 10)
logger.debug(f"퍼센티 등록 화면에 표시된 카테고리 텍스트 : {per_cat.text}")
product_infos[i-1].per_cat_code = per_cat.text
try:
click_to_product_title_for_modify_xpath = f"//div[{i}]/li/div/div/div[2]/div/div/div/div"
click_element(driver, 'XPATH', click_to_product_title_for_modify_xpath, 10, 'js')
logger.debug("상품 수정 페이지 클릭")
time.sleep(0.3)
tao_title_text_xpath = "//div[@id='productMainContentContainerId']/div/div/div[6]/div/div/span"
tao_title = return_element(driver, 'XPATH', tao_title_text_xpath, 10)
logger.debug(f"tao_title 텍스트 : {tao_title.text}")
product_infos[i-1].tao_title = tao_title.text
# 상품수정 페이지에 표시된 퍼센티카테고리 텍스트 수집
per_cat = return_element(driver, 'XPATH', '//div[8]/div/div/div[2]/div/div/div/span[2]/div/div', 10)
logger.debug(f"퍼센티 등록 화면에 표시된 카테고리 텍스트 : {per_cat.text}")
product_infos[i-1].per_cat_code = per_cat.text
except Exception as e:
logger.debug(f"상품 수정 페이지 클릭과 Tao_Title_Text 요소 찾는 중 오류 발생: {e}", exc_info=True)
# # 이미지 주소 복사