Skip to content

Instantly share code, notes, and snippets.

@Ardesco
Ardesco / Safari_Cookies
Created November 12, 2012 22:45
Safari Driver Patch To Remove All Cookies
/** Deletes all cookies visible to the current page. */
safaridriver.inject.commands.deleteCookies = function() {
var keys = goog.net.cookies.getKeys();
var domain = document.domain;
for (var i = keys.length - 1; i >= 0; i--) {
goog.net.cookies.remove(keys[i], "/", domain);
}
};
@Ardesco
Ardesco / AdditionalConditions.groovy
Created January 2, 2013 14:56
Wait until processing of jQuery has completed
public static ExpectedCondition<Boolean> processingOfJQueryHasFinished() {
new ExpectedCondition<Boolean>() {
@Override
Boolean apply(WebDriver driver) {
(Boolean) ((JavascriptExecutor) driver).executeScript("return jQuery.active === 0;")
}
}
}
@Ardesco
Ardesco / groovy_selenium_demo.groovy
Created January 27, 2013 20:38
Solution for bensullivan
import org.openqa.selenium.By
import org.openqa.selenium.StaleElementReferenceException
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.support.ui.ExpectedCondition
import org.openqa.selenium.support.ui.WebDriverWait
import static org.openqa.selenium.support.ui.ExpectedConditions.elementToBeClickable
import static org.openqa.selenium.support.ui.ExpectedConditions.findElement
@Ardesco
Ardesco / dataProviderExample.java
Created January 28, 2013 22:15
Fixed DataProvider example for paul rankin
package com.lazerycode.ebselen.website.google;
import com.thoughtworks.selenium.SeleneseTestCase;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import org.openqa.selenium.server.SeleniumServer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@Ardesco
Ardesco / dataProviderExample.java
Created January 28, 2013 23:25
DataProvider example converted to WebDriver API for paul rankin
package com.lazerycode.ebselen.website.google;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
@Ardesco
Ardesco / gist:5005206
Created February 21, 2013 14:53
NPE Stack trace
Error Message
java.lang.NullPointerException
Stacktrace
java.lang.NullPointerException
at org.openqa.selenium.remote.RemoteWebElement.getLocation(RemoteWebElement.java:334)
at org.openqa.selenium.remote.RemoteWebElement$1.onPage(RemoteWebElement.java:398)
at org.openqa.selenium.interactions.internal.Coordinates$onPage.call(Unknown Source)
at com.telefonica.smartsteps.webui.pagemodel.charts.LineChart.hoverOverGraphPointAtXAxisPosition(LineChart.groovy:50)
@Ardesco
Ardesco / driverName.html
Created September 5, 2014 19:22
Refactored random name generator
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script type="application/javascript">
function pickARandomDriverName(element) {
"use strict";
var firstNames = ["Giuseppe", "Juan Manuel", "Alberto", "Mike", "Jack", "Bob"];
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
function usage(){
echo -e "\nThis script will record what is happening on an Android device"
echo -e " "
echo -e "Usage: './`basename $0` foo' or './`basename $0` foo.mp4'"
echo -e "Both of the above will produce a recording with the filename 'foo.mp4'"
body {
font-family: sans-serif;
background: #000000;
color: #fefefe;
font-size: 14px;
}
div.pipeline-loading-icon {
content: url("dark-load.gif");
}
@Ardesco
Ardesco / Keybase.md
Created October 5, 2017 22:07
Keybase.md

Keybase proof

I hereby claim:

  • I am ardesco on github.
  • I am ardesco (https://keybase.io/ardesco) on keybase.
  • I have a public key ASCDrBg9jHlR-1yl3tZZXLvzI6rDOD8w-ctc49BO63hJnwo

To claim this, I am signing this object: