Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Crawl_Translation(request):
- driver = webdriver.PhantomJS()
- driver.maximize_window()
- driver.implicitly_wait(10)
- action = action_chains.ActionChains(driver)
- URL = "https://translate.google.co.kr/#en/ko/"
- driver.get(URL)
- driver.find_element_by_xpath('//*[@id="source"]').send_keys('I want to eat cheese hamburger')
- action.send_keys(keys.Keys.ENTER)
- action.perform()
- time.sleep(5)
- driver.save_screenshot('scrshot.png')
- driver.find_element_by_xpath('//*[@id="gt-res-listen"]').click()
- time.sleep(5)
- soupstr = driver.find_element_by_xpath('//*[@id="result_box"]')
- return HttpResponse(soupstr.text)
Add Comment
Please, Sign In to add comment