Skip to content

Instantly share code, notes, and snippets.

View illicitonion's full-sized avatar

Daniel Wagner-Hall illicitonion

View GitHub Profile
import org.openqa.selenium.firefox.FirefoxDriver;
public class Main {
public static void main(String[] args) throws Exception {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
System.out.println((String) ((JavascriptExecutor)driver).executeScript("return '\n';"));
System.out.println("Done");
}
}
<message priority="info"><![CDATA[Exception in thread "main" java.lang.NullPointerException]]></message>
<message priority="info"><![CDATA[ at org.openqa.selenium.internal.IgnoreCollector$IgnoredTestCase.asMap(IgnoreCollector.java:51)]]></message>
<message priority="info"><![CDATA[ at org.openqa.selenium.internal.IgnoreCollector.callback(IgnoreCollector.java:18)]]></message>
<message priority="info"><![CDATA[ at org.openqa.selenium.TestSuiteBuilder.invokeIgnoreCallbacks(TestSuiteBuilder.java:304)]]></message>
<message priority="info"><![CDATA[ at org.openqa.selenium.TestSuiteBuilder.isTestMethod(TestSuiteBuilder.java:275)]]></message>
<message priority="info"><![CDATA[ at org.openqa.selenium.TestSuiteBuilder.addTestsFromFile(TestSuiteBuilder.java:242)]]></message>
<message priority="info"><![CDATA[ at org.openqa.selenium.TestSuiteBuilder.addTestsRecursively(TestSuiteBuilder.java:176)]]></message>
<message priority="i
class ProxyType:
@classmethod
def make(cls, ff_value, string):
return {'ff_value': ff_value, 'string': string}
DIRECT = make(0, 'direct') # Direct connection, no proxy (default on Windows).
MANUAL = make(1, 'manual') # Manual proxy settings (e.g., for httpProxy).
PAC = make(2, 'pac') # Proxy autoconfiguration from URL.
RESERVED_1 = make(3, 'reserved1') # Never used.
@illicitonion
illicitonion / 11_rendering_text.html
Created March 22, 2012 23:10
W3C Browser Automation Spec - Rendering text draft 1
<section>
<h2>Rendering Text</h2>
<p>All WebDriver implementations must support getting the readable[1] text of a WebElement, with excess whitespace compressed. The expected return value is roughly what a text-only browser such as Lynx would display. The algorithm for determining this text is as follows:</p>
Initially, lines = [];
1: For each child of node, at time of execution, in order:
Get whitespace, text-transform, and then, if child is...
an ignored node [2]:
Do nothing.
a text node [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#text]:
@illicitonion
illicitonion / gist:2421306
Created April 19, 2012 14:28
Firefox proposal: Allow privileged extension contexts to cross origin boundaries.
Allow privileged extension contexts to cross origin boundaries.
Problem:
Before Firefox 8, extensions could manipulate any subframe through chromeWindow.getBrowser().contentWindow.frames[0].frameElement regardless of cross-origin status.
There are valid uses for this capability; any extension which manipulates content, password managers, etc. should reasonably expect to be able to manipulate iframes.
My motivating example usage is for browser automation for the purposes of test, where on the selenium/webdriver project has a bug reported which has picked up >40 followers in five months [putting it in the top 1.5% of bugs by popularity, where the top bugs have been open for several years]. Link to bug for reference: https://code.google.com/p/selenium/issues/detail?id=2863
Note that extensions have privilege to open new windows at arbitrary sites, and perform arbitrary manipulations on the pages, so preventing the manipulation of iframes in this way does not provide any obvious security benefit, other than re
Uber-jar: //java/server/src/org/openqa/selenium/server:server as build/java/server/src/org/openqa/selenium/server/server-standalone.jar
git: 'svn' is not a git command. See 'git --help'.
Did you mean one of these?
fsck
show
Project-jar: //java/server/src/org/openqa/selenium/server:server as build/java/server/src/org/openqa/selenium/server/server-nodeps.jar
git: 'svn' is not a git command. See 'git --help'.
Did you mean one of these?
Uber-jar: //java/server/src/org/openqa/selenium/server:server as build/java/server/src/org/openqa/selenium/server/server-standalone.jar
Unable to determine upstream SVN information from working tree history
Project-jar: //java/server/src/org/openqa/selenium/server:server as build/java/server/src/org/openqa/selenium/server/server-nodeps.jar
Unable to determine upstream SVN information from working tree history
@illicitonion
illicitonion / rach3.py
Created May 20, 2012 02:36
Rachmaninov's Third Piano Concerto, Played by Selenium
from selenium import webdriver
from time import sleep
d = webdriver.Chrome()
d.get('http://mrcoles.com/piano/')
sleep(2)
d.execute_script('document.querySelector(\'.keys\').style.width=\'791px\' ; var es = document.querySelectorAll(\'.black\') ; for (var e = 0 ; e < es.length ; ++e) { es[e].style.width = \'1px\'; }')
keymap = {'a': [-3, 9], 'a#': [-2, 10], 'bb': [-2, 10], 'b': [-1, 11], 'c': [-12, 0, 12], 'c#': [-11, 1], 'd': [-10, 2], 'd#': [-9, 3], 'eb': [-9, 3], 'e': [-8, 4], 'f': [-7, 5], 'f#': [-6, 6], 'g': [-5, 7], 'g#': [-4, 8]}
def key(letter, pos):
WebDriverServer.prototype.newDriver = function(window) {
if (null == this.useNativeEvents) {
var prefs =
fxdriver.moz.getService("@mozilla.org/preferences-service;1", "nsIPrefBranch");
if (!prefs.prefHasUserValue("webdriver_enable_native_events")) {
fxdriver.Logger.dumpn('webdriver_enable_native_events not set; defaulting to false');
}
this.enableNativeEvents =
prefs.prefHasUserValue("webdriver_enable_native_events") ?
prefs.getBoolPref("webdriver_enable_native_events") : false;
@illicitonion
illicitonion / gist:2956943
Created June 19, 2012 22:39
squid config
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
# TODO(santiycr): Set up localnet ACLs
acl localnet src 10.0.0.0/8
acl localnet src 172.16.0.0/12
acl localnet src 192.168.0.0/16
acl localnet src fc00::/7