본문 바로가기

프로그래머/Python

[selenium] “Element Is Not Clickable at Point” 해결법 | 팝업창 전환

python에서 selenium으로 웹 크롤링을 할 때, “Element Is Not Clickable at Point”에러가 날 때가 있다

위의 예시 그림과 같이, 웹 페이지의 정보가 팜업형태로 나타날 때, 팝업 창 위의 element를 크롤링 할 때 나타나는 에러이다.

팝업창에 마우스를 가져다 대서, inspect element를 해봤다.

자세히 보면 팝업 창의 형태는 iframe 내에 새로운 html이 들어가 있는 모양임을 알 수 있다.

# switch to iframe
driver.switch_to.frame('jqxIframe1')
time.sleep(3)

selenium의 switch_to.frame을 이용해, 해당 frame의 id로 창을 전환한 뒤, 잠시 멈췄다가 창 내의 element를 크롤링하면 성공