-
카테고리
-
세부 분야
업무 자동화
-
해결 여부
해결됨
셀레니움으로 thumb 이미지 클릭을 못합니다 도와주세요 ㅠ
23.04.17 00:59 작성 조회수 394
0
선생님 난관에 부딪혔습니다.
제목과, 이름은 잘가져오는데.
썸네일 이미지가 메뉴에 가려져 있어서, 클릭을 못한다고 합니다. 이를 어찌 해결해야 할지 도저히 모르겠습니다
일단 코드는 아래와 같습니다.
items = driver.find_elements(By.CSS_SELECTOR, "#_chartList > li.list_item")
time.sleep(2)
#_chartList .title.ellipsis
for idx, item in enumerate(items[:5], 1):
title = item.find_element(By.CSS_SELECTOR, 'p.title.ellipsis')
name = item.find_element(By.CSS_SELECTOR, 'span.name.ellipsis')
thumb = item.find_element(By.CSS_SELECTOR, 'div.thumb > a')
thumb.click()
time.sleep(2)
album_url = driver.current_url
driver.back()
print(f">>>{idx}<<<")
print(title.text.strip())
print(name.text.strip())
print(album_url)
print()
time.sleep(2)
실행하면 아래와 같은 오류가 납니다.
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <a href="javascript:goDetail('album','11211297')">...</a> is not clickable at point (40, 24). Other element would receive the click: <span class="ico-sprite ico-gnb-menu">...</span>
구글링 열심히 하다가 챗 gpt에게 물어보니
오약 : 메뉴 요소에 가려져있어서 클릭을 못하고, 메뉴 요소를 닫아야 한다고합니다
<span class="ico-sprite ico-gnb-menu">
이 메뉴 요소가 문제인거 같은데, 메뉴에 가려져 있으면 어떻게 해결 해야하나요?
어떡해든 혼자힘으로 해결해 보려고 하였는데, 이건 도저히 해결책을 어떻게 연구해야 할지 모르겠습니다.
도와 주신다면 감사하겠습니다.
답변을 작성해보세요.
답변 1