Skip to content

Instantly share code, notes, and snippets.

View santiycr's full-sized avatar
💭
Always learning

Santiago Suarez Ordoñez santiycr

💭
Always learning
View GitHub Profile
@santiycr
santiycr / sauce_browsers_coordination.py
Created August 6, 2010 17:36
Coordinate multiple browsers in Sauce OnDemand using threads
from threading import Thread
from selenium import selenium
import time
try:
import json
except ImportError:
import simplejson as json
USERNAME = "USERNAME"
ACCESS_KEY = "ACCESS-KEY"
@santiycr
santiycr / Tweet.java
Created March 11, 2011 23:15
Tweet about #SeleniumConf!
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import java.util.concurrent.TimeUnit;
public class Tweet {
public static void goTweet() throws Exception {
WebDriver driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("http://twitter.com");
@santiycr
santiycr / gist:1003731
Created June 2, 2011 01:12
Let Sauce know about your Selenium 1 python test results with 2 lines of code!
def tearDown(self):
passed = {'passed': self._exc_info() == (None, None, None)}
self.selenium.set_context("sauce: job-info=%s" % json.dumps(passed))
self.selenium.stop()
@santiycr
santiycr / implicit_wait_selenium.py
Created July 26, 2011 17:57
Implicit wait Selenium 1
import time, re
from selenium import selenium
class implicitWaitSelenium(selenium):
"""
Extending the regular selenium class to add implicit waits
"""
def __init__(self, *args):
self.implicit_wait = 30
@santiycr
santiycr / selenium_test_case.py
Created July 26, 2011 19:24
Ignoring open failures as letting call selenium commands right from self, reporting pass/fail status automatically
class SeleniumTestCase(TestCase):
# Let us just call self.click or self.type instead of self.selenium.type
def __getattr__(self, name):
if hasattr(self, 'selenium'):
return getattr(self.selenium, name)
raise AttributeError(name)
# Ignore open commands that fail (same needs to be don for wait_for_page_to_load)
def open(self, url, ignoreResponseCode=True):
@santiycr
santiycr / selenium2_test_case.py
Created July 26, 2011 19:32
Reporting pass/fail status automatically in Selenium 2 tests
class Selenium2TestCase(TestCase):
def report_pass_fail(self):
base64string = base64.encodestring('%s:%s' % (config['username'],
config['access-key']))[:-1]
result = json.dumps({'passed': self._exc_info() == (None, None, None)})
connection = httplib.HTTPConnection(self.config['host'])
connection.request('PUT', '/rest/v1/%s/jobs/%s' % (self.config['username'],
self.driver.session_id),
result,
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@santiycr
santiycr / TestingUploadSe2Sauce.java
Created December 22, 2011 04:44
Remote File Upload using Selenium 2's FileDetectors
import junit.framework.Assert;
import junit.framework.TestCase;
import org.openqa.selenium.*;
import org.openqa.selenium.remote.*;
import java.net.URL;
import java.util.concurrent.TimeUnit;
public class TestingUploadSe2Sauce extends TestCase {
private RemoteWebDriver driver;
@santiycr
santiycr / saucerest_python_example.py
Created January 20, 2012 01:37
Sauce REST API via Python
import httplib
import base64
try:
import json
except ImportError:
import simplejson as json
config = {"username": "your-sauce-username",
"access-key": "your-sauce-api-key"}
@aemkei
aemkei / LICENSE.txt
Last active April 12, 2024 21:27 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE