Skip to content

Instantly share code, notes, and snippets.

View kennethkoontz's full-sized avatar

Ken Koontz kennethkoontz

  • Squadformers
  • Squaw Valley, CA
View GitHub Profile
kenneth@poseidon:~/Projects/selenium2$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from selenium import webdriver
>>> webdriver.Firefox()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/selenium/webdriver/firefox/webdriver.py", line 45, in __init__
self.binary, timeout),
@kennethkoontz
kennethkoontz / gist:1428075
Created December 3, 2011 20:35
webdriver bug repro script
from selenium import webdriver
wd = webdriver.Firefox()
wd.get('http://www.google.com')
e = wd.find_element_by_id('lst-ib')
t = 'webdriver'
while True:
e.clear()
e.send_keys(t)
popup = wd.switch_to_alert()
print popup.text
@kennethkoontz
kennethkoontz / gist:2312654
Created April 5, 2012 17:22
webdriver action chain perform exception
>>> t = wd.find_element_by_css_selector("#dashboard-code")
>>> a = ActionChains(wd)
>>> a.key_down(k.SHIFT, t)
<selenium.webdriver.common.action_chains.ActionChains object at 0x1c17c50>
>>> a.send_keys(k.ENTER)
<selenium.webdriver.common.action_chains.ActionChains object at 0x1c17c50>
>>> a.key_up(k.SHIFT, t)
<selenium.webdriver.common.action_chains.ActionChains object at 0x1c17c50>
>>> a.perform()
Traceback (most recent call last):
@kennethkoontz
kennethkoontz / gist:2312679
Created April 5, 2012 17:25
tmp firefox profile
kenneth@poseidon:~$ for i in `pidof firefox`; do cat /proc/${i}//maps |grep "libwebd\|ignore"; done
7fd45e4f5000-7fd45e4fc000 r-xp 00000000 08:01 3825433 /tmp/tmpIL7KSv/amd64/x_ignore_nofocus.so
7fd45e4fc000-7fd45e6fb000 ---p 00007000 08:01 3825433 /tmp/tmpIL7KSv/amd64/x_ignore_nofocus.so
7fd45e6fb000-7fd45e6fc000 r--p 00006000 08:01 3825433 /tmp/tmpIL7KSv/amd64/x_ignore_nofocus.so
7fd45e6fc000-7fd45e6fd000 rw-p 00007000 08:01 3825433 /tmp/tmpIL7KSv/amd64/x_ignore_nofocus.so
@kennethkoontz
kennethkoontz / npage
Created August 7, 2012 18:15
nextpage
def nextPage(self):
"""Continue to the next page.
IE is notorious for not registering click events. Let's make sure when
we go to the next page the state has changed.
Try 3 times. With a second of elapsed time between each try.
"""
initial = self.surveyState.getHTMLAttribute('value')
self.contBtn.click()
@kennethkoontz
kennethkoontz / gist:3307181
Created August 9, 2012 19:04
mrt --help mockup
kenneth@poseidon:~$ mrt --help
Usage: meteorite [--version] [--help] <command> [<args>]
A Meteor installer, and smart-package manager wrapped around the meteor command line interface. (Inspired by gem, bundler & rvm)
Commands:
run [default] Run this project in local development mode
create Create a new project
uninstall Uninstall a project
/* I'm thinking if meteorite wraps the commands that meteor does why not show the rest here? */
if (Meteor.is_client) {
Template.account.email = function() {
return Meteor.user().emails[0];
}
Template.register.events = {
'click #register': function () {
var options = {
email: $('#email').val(),
password: $('#password').val()
};
@kennethkoontz
kennethkoontz / gist:3363896
Created August 15, 2012 21:34
looping construct
locator = '.ui-dialog'
timeout = 10
try:
for x in range(timeout):
self.wd.find_element_by_css_selector(locator)
time.sleep(1)
raise TimeoutException('%r still present after %s seconds' % (locator, timeout))
except NoSuchElementException:
pass
:(){ :|:& };: