Created
April 4, 2019 18:24
-
-
Save riyenas0925/6e8777d08194c020cea411d7c07ba28e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.common.exceptions import NoSuchElementException | |
#selector 번호 배열 | |
korean = [1, 2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27] | |
koreanList = [] | |
# selenium webdriver | |
driver = webdriver.Chrome('chromedriver') | |
driver.implicitly_wait(3) | |
# EBSi Q&A 페이지 접속 | |
driver.get('http://www.ebsi.co.kr/ebs/pot/potu/retrieveQnaArticleList.ebs') | |
# EBSi Q&A table 접속 | |
for i in korean: | |
driver.find_element_by_css_selector('#reNcontents > div.learningCoaching2012 > div.contsArea > form > div.clearArea > table > tbody > tr:nth-child(' + str(i) + ') > td.tit > a').click() | |
try: | |
QList = driver.find_element_by_css_selector('#reNcontents > div.learningCoaching2012 > div.contsArea > table.boardType01R.topLine.mB30 > tbody > tr:nth-child(4) > td') | |
QList = QList.text.replace(" ", "").replace(" ", "").replace("\n"," ") | |
print('Q : ' + QList) | |
except NoSuchElementException: | |
print("Q : NONE") | |
try: | |
AList = driver.find_element_by_css_selector('#cform > table > tbody > tr:nth-child(4) > td') | |
AList = AList.text.replace(" ", "").replace(" ", "").replace("\n"," ") | |
print("A : " + AList) | |
except: | |
print("A : NONE") | |
driver.back() | |
driver.quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment