1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
# 가상 브라우저 실행
# 파파고 번역 페이지(https://papago.naver.com/?sk=ko&tk=en) 이동
for key in translation_target:
driver.find_element_by_id('txtSource').clear()
driver.find_element_by_id('txtSource').send_keys(key)
time.sleep(3)
wait = WebDriverWait(driver, timeout=10)
wait.until(expected_conditions.presence_of_element_located((By.CSS_SELECTOR, "#targetEditArea > p")))
translated_contents = driver.find_element_by_id('txtTarget').text
translation_result_papago[translated_contents] = translation_target[key]
# 가상 브라우저 종료
|