Created
September 30, 2016 16:45
-
-
Save rodgomesc/9645aa7e3c6c305332fbf4a1e6fcda42 to your computer and use it in GitHub Desktop.
selenium script for open password panel e-gov.betha.com.br in upa
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
import time, os | |
from selenium import webdriver | |
user = "saudequiri" | |
password = "ps@2014" | |
ent = "FUNDO MUNICIPAL DE SAÚDE DE QUIRINOPOLIS" | |
local = "UPA" | |
browser = "firefox" | |
# not work in raspberry for a while | |
def chrome_env(): | |
chromedriver = "/home/administrador-x/PycharmProjects/upa/chromedriver" | |
os.environ["webdriver.chrome.driver"] = chromedriver | |
options = webdriver.ChromeOptions() | |
# options.add_argument("--kiosk") | |
args = webdriver.Chrome(chromedriver, chrome_options=options) | |
return args | |
#only work firefox 45 --> sudo apt-get install firefox=45.0.2+build1-0ubuntu1 | |
def firefox_env(): | |
profile = webdriver.FirefoxProfile('/home/upa/.mozilla/firefox/sd16ckwn.upa') | |
args = webdriver.Firefox(profile) | |
return args | |
if browser is "chrome": | |
driver = chrome_env() | |
elif browser is "firefox": | |
driver = firefox_env() | |
driver.get("http://e-gov.betha.com.br/saude/") | |
driver.find_element_by_id("login:iUsuarios").send_keys(user) | |
driver.find_element_by_id("login:senha").send_keys(password) | |
driver.find_element_by_id("login:btAcessar").click() | |
try: | |
driver.find_element_by_partial_link_text(ent).click() | |
except: | |
pass | |
driver.get(driver.current_url[:-10] + "painelsenha.faces") | |
driver.find_element_by_partial_link_text(local).click() | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment