이번 포스팅에서는 ~ is not clickable at point ~ 문구로 오류가 발생할 경우 어떻게 해결 해야 하는지 알아 볼게요.
에러 문을 보면 알수 있듯 해당 부분을 셀레니움으로 클릭할 수 없다는 내용입니다.
분명 클릭할 수 있는 부분인것 같은 데 왜 클릭이 안되지 라는 의문이 드시는 분들이 있을 것 같은데요.
이건 태그 특성상 클릭이 안되는 부분일 가능성이 높습니다.
예를 통해 설명을 드려보겠습니다.
![[selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법 [selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법](http://t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png)
저는 네이버 쇼핑몰에서 해당 더보기 버튼을 누르고 싶습니다.
개발자창을 확인해보니, "더보기"라는 text가 있으니까 저부분을 클릭 하면 되겠라고 생각하고 해당부분을 scraping 합니다.
![[selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법 [selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법](http://t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png)
참고로 해당 부분을 xpath로 가져오려면 //*[text()="연관검색어"] 입니다.
(xpath에 대해서 잘모르시는분 해당 포스팅을 참조하기 바랍니다.)
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
import time
keyword = '쿠션슬리퍼'
url = 'https://search.shopping.naver.com/search/all?query='+keyword
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get(url)
WebDriverWait(driver,timeout=5).until(EC.presence_of_element_located((By.XPATH, '//*[text()="연관검색어"]')))
driver.find_element(by=By.XPATH, value='//*[text()="연관검색어"]').click()
하지만 아래와 같은 에러를 만나게 됩니다.
output:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <span class="blind">...</span> is not clickable at point (939, 117). Other element would receive the click: <div class="relatedTags_relation_srh__1CleC">...</div>
(Session info: chrome=99.0.4844.84)
이럴때는 span 태그의 부모태그인 button 태그를 선택해주면 해결이 가능합니다.
참고로 해당 부분을 xpath로 가져오려면 //*[text()="연관검색어"]//.. 입니다.
'파이썬 > 크롤링' 카테고리의 다른 글
[크롤링 기초] svg 태그 찾기 (with xpath 셀레니움) (1) | 2022.04.19 |
---|---|
[셀레니움 기초] 네이버 쇼핑 크롤링 중 차단?(headless 사용시 주의사항) (0) | 2022.04.07 |
[셀레니움 기초] StaleElementReferenceException 오류 해결 (0) | 2022.04.07 |
[크롤링 기초] 부모(상위)태그 | 자식(하위)태그 | 형제 태그 개념 (0) | 2022.03.30 |
[Python 셀레니움] executable_path has been deprecated, please pass in a Service object 에러 해결 방법 (2) | 2022.03.15 |
댓글
꼬예님의
글이 좋았다면 응원을 보내주세요!
이 글이 도움이 됐다면, 응원 댓글을 써보세요. 블로거에게 지급되는 응원금은 새로운 창작의 큰 힘이 됩니다.
응원 댓글은 만 14세 이상 카카오계정 이용자라면 누구나 편하게 작성, 결제할 수 있습니다.
글 본문, 댓글 목록 등을 통해 응원한 팬과 응원 댓글, 응원금을 강조해 보여줍니다.
응원금은 앱에서는 인앱결제, 웹에서는 카카오페이 및 신용카드로 결제할 수 있습니다.