inflearn logo
강의

講義

知識共有

Pythonを使用したWeb Crawlingアプリケーションの作成

01 - Web環境の理解1

크롤링 오류

234

bigsea0070390

投稿した質問数 1

0

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import time

from urllib.request  import urlopen
from urllib.parse import quote_plus
from bs4 import BeautifulSoup  
from requests_html import HTMLSession
import time
driver = webdriver.Chrome() 

session = HTMLSession()

baseUrl = 'https://www.courtauction.go.kr/'

driver.get(baseUrl)
print(driver.window_handles)
time.sleep(3)
driver.switch_to.window(driver.window_handles[1])
driver.close()
driver.switch_to.window(driver.window_handles[0])
print(driver.window_handles) 


f = open('jquery-3.4.1.min.js''r')
driver.execute_script(f.read())
element = driver.find_element_by_xpath("/html/body/div/div/div[4]/div[3]/div[2]/div[1]/form/div/div")
element.click()
print(element) 
#main_btn > a
#javascript = driver.find_element_by_xpath('//*[@id="main_btn"]/div') 
#javascript.click()

f.close()
이렇게 크롤링을 했는데 아래처럼 오류가 나요 이유를 모를겠씁니다
PS C:\Users\USER\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\selenium\webdriver> python py4.py DevTools listening on ws://127.0.0.1:57644/devtools/browser/ce3a0c10-1e5f-448a-9768-7a3731b4bdba ['CDwindow-761E40B9B36801AA66BCBD3A4BD8C663'] KLIB_SelfTest return : KLR_OK ['CDwindow-761E40B9B36801AA66BCBD3A4BD8C663'] Traceback (most recent call last): PS C:\Users\USER\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\selenium\webdriver> python py4.py DevTools listening on ws://127.0.0.1:58047/devtools/browser/b5b368df-a040-40c0-b20c-9754ab89abe0 PS C:\Users\USER\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\selenium\webdriver> python py4.py DevTools listening on ws://127.0.0.1:58108/devtools/browser/9d932f6e-10bc-444a-8254-1d45d4a1d35d ['CDwindow-FCDFF87FC00982E5E47F38B05CCA7CD5'] KLIB_SelfTest return : KLR_OK ['CDwindow-FCDFF87FC00982E5E47F38B05CCA7CD5'] Traceback (most recent call last): File "py4.py", line 29, in <module> element = driver.find_element_by_xpath("/html/body/div/div/div[4]/div[3]/div[2]/div[1]/form/div/div") File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\USER\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div/div/div[4]/div[3]/div[2]/div[1]/form/div/div"} (Session info: chrome=83.0.4103.106)

웹-크롤링 python

回答 0

전처리 관련질문

0

3

2

수강기간즘연장해주세요

0

4

1

작업형3 기출

0

6

1

유형2에서 데이터분할 생략 가능여부

0

7

1

9회 기출 유형3 질문

0

8

1

lgb 기초편

0

5

1

수업자료 문의

0

8

1

괄호 사용

0

9

1

작업형 2 데이터 전처리 질문

0

10

0

11회 기출 유형 작업형1 문제 3-1

0

9

0

7회 3유형 2번문제 질문

0

8

1

예시문제 작업형2 (ver2023) 질문입니다

0

11

1

Data type에 따른 처리

0

7

1

Cursor 실행 문의

1

11

2

데이터 전처리 관련

0

14

2

시험에서 문제 불러오기

0

12

2

2번문제 출력값 질문

0

17

2

pd.get_dummies()가 bool로 반환

0

16

2

대응표본검정 레빈

0

20

3

단일표본검정 문제 유형

0

22

2

dmoz.org에 접속하면 400 Bad Request에러가 납니다

0

228

0

패키지 설치부분

0

321

0

블로그에 ppt와 강의영상을 토대로 정리를 해도 될까요??

0

308

1

안녕하세요. 궁금한 점이 있습니다.

0

226

0