Skip to content

Instantly share code, notes, and snippets.

@netoxico
Created August 30, 2012 15:49
Show Gist options
  • Save netoxico/3531433 to your computer and use it in GitHub Desktop.
Save netoxico/3531433 to your computer and use it in GitHub Desktop.
Selenium fill personal Redmine
# Requires selenium==2.24.0
# Pip install selenium
# To run:
# python redmine.py
try:
import unittest2 as unittest
except ImportError:
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class FillRedmine(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def tearDown(self):
#self.browser.close()
pass
def test_issue_1867(self):
self.browser.get("http://redmine.nearbpo.com/")
cookie = {
u'domain': u'redmine.nearbpo.com',
u'name': u'_redmine_session',
u'value': u'KEY_VALUE',
u'expiry': None,
u'path':
u'/', u'secure': False
}
self.browser.add_cookie(cookie)
self.browser.get("http://redmine.nearbpo.com/issues/1867/time_entries/new")
time = self.browser.find_element_by_id("time_entry_hours")
time.send_keys("8")
activity = self.browser.find_element_by_id("time_entry_activity_id")
for option in activity.find_elements_by_tag_name("option"):
if option.text == "Desarrollo":
option.click()
if __name__ == '__main__':
unittest.main(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment