Skip to content

Instantly share code, notes, and snippets.

@mz0
Last active December 3, 2015 07:47
Show Gist options
  • Save mz0/64617504f19fd1d12688 to your computer and use it in GitHub Desktop.
Save mz0/64617504f19fd1d12688 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from os.path import expanduser
from selenium.webdriver import FirefoxProfile, Firefox
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
home = expanduser("~")
fzp = home + '/.mozilla/firefox/zapR'
print(fzp)
ff = Firefox(firefox_profile=FirefoxProfile(profile_directory=fzp))
vaapp1='http://hoost1:36500/vaapp-1-env1'
ff.get(vaapp1)
# http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp
idLoginInp = 'common.LoginView.Username'
idPasswInp = "common.LoginView.Password"
try:
elem = WebDriverWait(ff, 15).until(EC.presence_of_element_located((By.ID, idLoginInp)))
elem.send_keys('Ruben1')
elem = ff.find_element_by_id(idPasswInp)
elem.send_keys('pls323')
elem.send_keys(Keys.RETURN)
finally:
print('Ok1')
idNavBtn='common.HeaderComponent.mainLayout.btnNavigate'
try:
elem = WebDriverWait(ff, 15).until(EC.presence_of_element_located((By.ID, idNavBtn)))
finally:
print('Ok2')
print('Ok3')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment