티스토리 뷰
from selenium import webdriver
import bs4
dr=webdriver.Chrome('C:\chromedriver.exe') #exe 파일 위치
dr.implicitly_wait(1)
start_num=228
file=open('C:/Users/User/Desktop/WEB/readfile.txt','r')
buff="000"
for i in range(0,39):
fw=open('./2장/output'+str(2+i)+'.txt','w',encoding='utf-8')
url="" #url 설정
dr.get(url)
html=dr.page_source
soup=bs4.BeautifulSoup(html,'html.parser')
dr.implicitly_wait(1)
_input=file.readline()
if(buff!=_input):
print(_input)
buff=_input
dr.find_element_by_xpath('//*[@id="entry'+str(i+start_num)+'password"]').send_keys(_input)
dr.implicitly_wait(1)
dr.get(url)
html=dr.page_source
soup=bs4.BeautifulSoup(html,'html.parser')
soup=soup.select_one("body")
_output=soup.get_text()
fw.write(_output)
file.close
fw.lose
find_element_by_xpath
요소의 경로(전체/상대) 정보를 바탕으로 검색
dr.find_element_by_xpath('//*[@id="entry'+str(i+start_num)+'password"]').send_keys(_input)
: id 값이 entry~~password 인 요소 검색
그 외
Python Selenium 사용법 [파이썬 셀레늄 사용법, 크롤링] (greeksharifa.github.io)
Python, Machine & Deep Learning
Python, Machine Learning & Deep Learning
greeksharifa.github.io
'WEB' 카테고리의 다른 글
sql 기본 .. 정리 (0) | 2021.07.29 |
---|
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 위상 정렬
- dp
- 백트래킹
- 동적계획법
- 구간 합
- 비트마스킹
- prirotyqueue
- HashSet
- Sort
- 최단 거리
- RequiredArgsConstructor
- 누적 합
- 분할 정복
- 희소 배열
- 참조 지역성
- Knapsack
- 부분 합
- 이분탐색
- LowerBound
- MinHeap
- 완전 탐색
- 분할정복
- Greedy
- Priority Queue
- Segment Tree
- 배낭 문제
- 페르마의 정리
- 완전탐색
- dfs
- MaxHeap
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함