Advertisement
Guest User

Untitled

a guest
Sep 8th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4.  
  5.  
  6. from selenium import webdriver
  7. from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
  8.  
  9. driver = webdriver.Firefox()
  10. # driver = webdriver.Chrome()
  11.  
  12. baseurl = """https://esaj.tjsp.jus.br/cpopg/open.do?gateway=true"""
  13.  
  14. processo = '0015348-83.2012'
  15. processo = '0015348-83.2012.8.26.0278'
  16. parcoesso_part1 = processo[:15]
  17. parcoesso_part2 = processo[21:]
  18. driver.get(baseurl)
  19. cpf = driver.find_element_by_id("usernameForm");
  20. cpf.send_keys("87496828068");
  21. password = driver.find_element_by_id("passwordForm");
  22. password.send_keys("asdfghjkl");
  23.  
  24. driver.find_element_by_id('pbEntrar').click()
  25.  
  26. numeroDigitoAnoUnificado = password = driver.find_element_by_id("numeroDigitoAnoUnificado");
  27. numeroDigitoAnoUnificado.send_keys(parcoesso_part1);
  28.  
  29. foroNumeroUnificado = driver.find_element_by_id("JTRNumeroUnificado");
  30. foroNumeroUnificado.send_keys(parcoesso_part2);
  31.  
  32. # click Pesquisar
  33. driver.find_element_by_id('pbEnviar').click()
  34.  
  35. elems = driver.find_elements_by_class_name("linkMovVincProc");
  36. linkToDownload = False
  37. for elem in elems:
  38.     if u'Sentença' in elem.get_attribute('text'):
  39.         linkToDownload = elem.get_attribute("href")
  40.  
  41. if linkToDownload:
  42.     driver.get(linkToDownload)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement