무효 클릭 IP 추적 중...
파이썬/크롤링

[selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법

꼬예 2022. 4. 6.
[selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법

목차

    이번 포스팅에서는 ~ is not clickable at point ~ 문구로 오류가 발생할 경우 어떻게 해결 해야 하는지 알아 볼게요.

    에러 문을 보면 알수 있듯 해당 부분을 셀레니움으로 클릭할 수 없다는 내용입니다. 

    분명 클릭할 수 있는 부분인것 같은 데 왜 클릭이 안되지 라는 의문이 드시는 분들이 있을 것 같은데요.

     

    이건 태그 특성상 클릭이 안되는 부분일 가능성이 높습니다.

     

     

    예를 통해 설명을 드려보겠습니다.

    [selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법

    저는 네이버 쇼핑몰에서 해당 더보기 버튼을 누르고 싶습니다.

     

    개발자창을 확인해보니, "더보기"라는 text가 있으니까 저부분을 클릭 하면 되겠라고 생각하고 해당부분을 scraping 합니다.

    [selenium 기초] 셀레니움 ~ is not clickable at point ~ 오류 해결 방법

     

    참고로 해당 부분을 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()="연관검색어"]//.. 입니다.

     

     

     

    • 트위터 공유하기
    • 페이스북 공유하기
    • 카카오톡 공유하기
    이 컨텐츠가 마음에 드셨다면 커피 한잔(후원) ☕

    댓글

    꼬예님의
    글이 좋았다면 응원을 보내주세요!