커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
뉴스크롤링 자동화
칼퇴를 부르는 파이썬 업무 자동화 v0
2주차
북마크
김*만
댓글
13
추천
0
조회수
12
조회수
12
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


아래와 같이 소스 입력후 input을 입력하면


from selenium import webdriver

from selenium.webdriver.chrome.options import Options

from selenium.webdriver.common.by import By


chrome_options = Options()

chrome_options.add_experimental_option("detach", True)

chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"])

driver = webdriver.Chrome(options=chrome_options)


keyword = input('뉴스 키워드를 입력해주세요.')


# 예시로 Google의 날씨 정보 페이지로 이동

driver.get(f"https://search.naver.com/search.naver?ssc=tab.news.all&where=news&sm=tab_jum&query={keyword}")


title_list = driver.find_elements(By.CLASS_NAME, 'news_tit')

for title in title_list:

    print(title.text)






작성한 코드 및 에러 메세지

(.venv) D:\파이썬\스파르타\automation\crawiling>d:/파이썬/스파르타/automation/crawiling/.venv/Scripts/python.exe d:/파이썬/스파르타/automation/crawiling/news_crawling.py

뉴스 키워드를 입력해주세요: 팀스파르타

Traceback (most recent call last):

 File "d:\파이썬\스파르타\automation\crawiling\news_crawling.py", line 13, in 

<module>

  driver.get(f"https://search.naver.com/search.naver?ssc=tab.news.all&where=news&sm=tab_jum&query={keyword}")

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 353, in get

  self.execute(Command.GET, {"url": url})

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute

  self.error_handler.check_response(response)

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response

  raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed

from unknown error: web view not found

 (Session info: chrome=128.0.6613.119)

Stacktrace:

    GetHandleVerifier [0x00007FF72148B5D2+29090]

    (No symbol) [0x00007FF7213FE689]

    (No symbol) [0x00007FF7212BB1CA]

    (No symbol) [0x00007FF72128FAF5]

    (No symbol) [0x00007FF72133E2E7]

    (No symbol) [0x00007FF721355EE1]

    (No symbol) [0x00007FF721336493]

    (No symbol) [0x00007FF7213009B1]

    (No symbol) [0x00007FF721301B11]

    GetHandleVerifier [0x00007FF7217A8C5D+3295277]

    GetHandleVerifier [0x00007FF7217F4843+3605523]

    GetHandleVerifier [0x00007FF7217EA707+3564247]

    GetHandleVerifier [0x00007FF721546EB6+797318]

    (No symbol) [0x00007FF72140980F]

    (No symbol) [0x00007FF7214053F4]

    (No symbol) [0x00007FF721405580]

    (No symbol) [0x00007FF7213F4A1F]

    BaseThreadInitThunk [0x00007FF928C87374+20]

    RtlUserThreadStart [0x00007FF92ABDCC91+33]



(.venv) D:\파이썬\스파르타\automation\crawiling>d:/파이썬/스파르타/automation/crawiling/.venv/Scripts/python.exe d:/파이썬/스파르타/automation/crawiling/news_crawling.py

뉴스 키워드를 입력해주세요: 팀스파르타

Traceback (most recent call last):

 File "d:\파이썬\스파르타\automation\crawiling\news_crawling.py", line 13, in 

<module>

  driver.get(f"https://search.naver.com/search.naver?ssc=tab.news.all&where=news&sm=tab_jum&query={keyword}")

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 353, in get

  self.execute(Command.GET, {"url": url})

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute

  self.error_handler.check_response(response)

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response

  raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed

from unknown error: web view not found

 (Session info: chrome=128.0.6613.119)

Stacktrace:

    GetHandleVerifier [0x00007FF72148B5D2+29090]

    (No symbol) [0x00007FF7213FE689]

    (No symbol) [0x00007FF7212BB1CA]

    (No symbol) [0x00007FF72128FAF5]

    (No symbol) [0x00007FF72133E2E7]

    (No symbol) [0x00007FF721355EE1]

    (No symbol) [0x00007FF721336493]

    (No symbol) [0x00007FF7213009B1]

    (No symbol) [0x00007FF721301B11]

    GetHandleVerifier [0x00007FF7217A8C5D+3295277]

    GetHandleVerifier [0x00007FF7217F4843+3605523]

    GetHandleVerifier [0x00007FF7217EA707+3564247]

    GetHandleVerifier [0x00007FF721546EB6+797318]

    (No symbol) [0x00007FF72140980F]

    (No symbol) [0x00007FF7214053F4]

    (No symbol) [0x00007FF721405580]

    (No symbol) [0x00007FF7213F4A1F]

    BaseThreadInitThunk [0x00007FF928C87374+20]

    RtlUserThreadStart [0x00007FF92ABDCC91+33]



(.venv) D:\파이썬\스파르타\automation\crawiling>d:/파이썬/스파르타/automation/crawiling/.venv/Scripts/python.exe d:/파이썬/스파르타/automation/crawiling/news_crawling.py

뉴스 키워드를 입력해주세요:팀스파르타

Traceback (most recent call last):

 File "d:\파이썬\스파르타\automation\crawiling\news_crawling.py", line 13, in 

<module>

  driver.get(f"https://search.naver.com/search.naver?ssc=tab.news.all&where=news&sm=tab_jum&query={keyword}")

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 353, in get

  self.execute(Command.GET, {"url": url})

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute

  self.error_handler.check_response(response)

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response

  raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed

from unknown error: web view not found

 (Session info: chrome=128.0.6613.119)

Stacktrace:

    GetHandleVerifier [0x00007FF72148B5D2+29090]

    (No symbol) [0x00007FF7213FE689]

    (No symbol) [0x00007FF7212BB1CA]

    (No symbol) [0x00007FF72128FAF5]

    (No symbol) [0x00007FF72133E2E7]

    (No symbol) [0x00007FF721355EE1]

    (No symbol) [0x00007FF721336493]

    (No symbol) [0x00007FF7213009B1]

    (No symbol) [0x00007FF721301B11]

    GetHandleVerifier [0x00007FF7217A8C5D+3295277]

    GetHandleVerifier [0x00007FF7217F4843+3605523]

    GetHandleVerifier [0x00007FF7217EA707+3564247]

    GetHandleVerifier [0x00007FF721546EB6+797318]

    (No symbol) [0x00007FF72140980F]

    (No symbol) [0x00007FF7214053F4]

    (No symbol) [0x00007FF721405580]

    (No symbol) [0x00007FF7213F4A1F]

    BaseThreadInitThunk [0x00007FF928C87374+20]

    RtlUserThreadStart [0x00007FF92ABDCC91+33]



(.venv) D:\파이썬\스파르타\automation\crawiling>d:/파이썬/스파르타/automation/crawiling/.venv/Scripts/python.exe d:/파이썬/스파르타/automation/crawiling/news_crawling.py

뉴스 키워드를 입력해주세요.스파르타

Traceback (most recent call last):

 File "d:\파이썬\스파르타\automation\crawiling\news_crawling.py", line 13, in 

<module>

  driver.get(f"https://search.naver.com/search.naver?ssc=tab.news.all&where=news&sm=tab_jum&query={keyword}")

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 353, in get

  self.execute(Command.GET, {"url": url})

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute

  self.error_handler.check_response(response)

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response

  raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed

from unknown error: web view not found

 (Session info: chrome=128.0.6613.119)

Stacktrace:

    GetHandleVerifier [0x00007FF72148B5D2+29090]

    (No symbol) [0x00007FF7213FE689]

    (No symbol) [0x00007FF7212BB1CA]

    (No symbol) [0x00007FF72128FAF5]

    (No symbol) [0x00007FF72133E2E7]

    (No symbol) [0x00007FF721355EE1]

    (No symbol) [0x00007FF721336493]

    (No symbol) [0x00007FF7213009B1]

    (No symbol) [0x00007FF721301B11]

    GetHandleVerifier [0x00007FF7217A8C5D+3295277]

    GetHandleVerifier [0x00007FF7217F4843+3605523]


(.venv) D:\파이썬\스파르타\automation\crawiling>d:/파이썬/스파르타/automation/crawiling/.venv/Scripts/python.exe d:/파이썬/스파르타/automation/crawiling/news_crawling.py

뉴스 키워드를 입력해주세요.스파르타

Traceback (most recent call last):

 File "d:\파이썬\스파르타\automation\crawiling\news_crawling.py", line 13, in 

<module>

  driver.get(f"https://search.naver.com/search.naver?ssc=tab.news.all&where=news&sm=tab_jum&query={keyword}")

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 353, in get

  self.execute(Command.GET, {"url": url})

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 344, in execute

  self.error_handler.check_response(response)

 File "d:\파이썬\스파르타\automation\crawiling\.venv\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 229, in check_response

  raise exception_class(message, screen, stacktrace)

selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed

from unknown error: web view not found

 (Session info: chrome=128.0.6613.119)

Stacktrace:

    GetHandleVerifier [0x00007FF72148B5D2+29090]

    (No symbol) [0x00007FF7213FE689]

    (No symbol) [0x00007FF7212BB1CA]

    (No symbol) [0x00007FF72128FAF5]

    (No symbol) [0x00007FF72133E2E7]

    (No symbol) [0x00007FF721355EE1]

    (No symbol) [0x00007FF721336493]

    (No symbol) [0x00007FF7213009B1]

    (No symbol) [0x00007FF721301B11]

    GetHandleVerifier [0x00007FF7217A8C5D+3295277]

    GetHandleVerifier [0x00007FF7217F4843+3605523]

    GetHandleVerifier [0x00007FF7217EA707+3564247]

    GetHandleVerifier [0x00007FF721546EB6+797318]

    (No symbol) [0x00007FF72140980F]

    (No symbol) [0x00007FF7214053F4]

    (No symbol) [0x00007FF721405580]

    (No symbol) [0x00007FF7213F4A1F]

    BaseThreadInitThunk [0x00007FF928C87374+20]

    RtlUserThreadStart [0x00007FF92ABDCC91+33]



(.venv) D:\파이썬\스파르타\automation\crawiling>오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.

Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.

Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴