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 / gist:4285972
Created December 14, 2012 14:51
Thread dump of Selenium's proxy using bouncycastle 1.48b06
sso ~/Dev/selenium • java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar master ✗ [11:49:05]
11:49:17.356 INFO - Java: Apple Inc. 20.12-b01-434
11:49:17.358 INFO - OS: Mac OS X 10.8.2 x86_64
11:49:17.366 INFO - v2.25.0, with Core v2.25.0. Built from revision 18033
11:49:17.465 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
11:49:17.466 INFO - Version Jetty/5.1.x
11:49:17.466 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:49:17.467 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:49:17.467 INFO - Started HttpContext[/,/]
11:49:17.504 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@60f47bf5
@santiycr
santiycr / dump_on_consequent_requests.log
Created December 14, 2012 06:01
Thread dump while selenium's stuck proxying HTTPS
Full thread dump Java HotSpot(TM) 64-Bit Server VM (20.12-b01-434 mixed mode):
"Thread-13" prio=5 tid=7faef49dd000 nid=0x116efa000 runnable [116ef9000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at org.openqa.jetty.util.LineInput.fill(LineInput.java:477)
at org.openqa.jetty.util.LineInput.read(LineInput.java:352)
- locked <7f3cd0c70> (a org.openqa.jetty.util.LineInput)
at org.openqa.jetty.http.HttpTunnel.copyBytes(HttpTunnel.java:199)
@santiycr
santiycr / import_and_run.py
Created December 13, 2012 06:44
Run python unit tests from a different python script
import unittest
import test_example
unittest.main(module=test_example)
@santiycr
santiycr / Se2_Sauce_proxy.py
Created September 12, 2012 21:29
Make Browsers running in the Sauce Cloud navigate through your own HTTP proxy
#!/usr/bin/env python
#-.- coding=utf8 -.-
import unittest
from selenium import webdriver
import os
from selenium.webdriver.common.proxy import Proxy
class Selenium2OnSauce(unittest.TestCase):
@santiycr
santiycr / selenium_sauce_tests.py
Created August 13, 2012 18:19
Run multiple browsers on Sauce in parallel using some python magic
#!/usr/bin/env python
# encoding: utf-8
from selenium import webdriver
import unittest
import nose
from nose.plugins.multiprocess import MultiProcess
import new
import json
import httplib
package tests;
import junit.framework.TestCase;
import com.thoughtworks.selenium.*;
public class TestingSe1Sauce extends TestCase {
private DefaultSelenium selenium;
public void setUp() throws Exception {
DefaultSelenium selenium = new DefaultSelenium(
@santiycr
santiycr / TestProxy.java
Created March 5, 2012 21:48
Repro on slow Selenium proxy for HTTPS pages
package tests;
import junit.framework.TestCase;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.*;
import org.openqa.selenium.remote.*;
import java.util.concurrent.TimeUnit;
public class ProxyTest extends TestCase {
sso➜proyectos_OS/selenium/trunk» ack toolkit.telemetry [17:03:46]
docs/api/py/_modules/selenium/webdriver/firefox/firefox_profile.html
123: <span class="s">&quot;toolkit.telemetry.prompted&quot;</span><span class="p">:</span> <span class="s">&quot;2&quot;</span><span class="p">,</span>
docs/api/rb/Selenium/WebDriver/Firefox/Profile.html
185: <span class='string val'>&quot;toolkit.telemetry.prompted&quot;</span> <span class='assign token'>=</span><span class='gt op'>&gt;</span> <span class='string val'>'2'</span><span class='comma token'>,</span>
dotnet/src/WebDriver/Firefox/FirefoxProfile.cs
474: AddDefaultPreference(prefs, "toolkit.telemetry.enabled", "false");
475: AddDefaultPreference(prefs, "toolkit.telemetry.prompted", "2");
@santiycr
santiycr / gist:1644502
Created January 20, 2012 01:53
Sauce REST API via CURL
curl -H "Content-Type:text/json" -s -X PUT -d '{"passed": true}' http://$USERNAME:$KEY@saucelabs.com/rest/v1/$USERNAME/jobs/$JOBID
@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"}