Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View FriendlyTester's full-sized avatar

Richard Bradshaw FriendlyTester

View GitHub Profile
@FriendlyTester
FriendlyTester / AndroidRecord.sh
Created January 30, 2015 17:04
BASH script to record Android display and download/delete the video
#Check if an argument was supplied
if [ -z "$1" ]
then
echo "No argument supplied, please provide video name"
else
# start recording
adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 &
# Get its PID
PID=$!
@FriendlyTester
FriendlyTester / LogSounds.sh
Last active July 2, 2021 08:37
Shell Script To Play Sounds On Word Match
tail -n 0 -f log.txt | grep --line-buffered 'ERROR' | while read line; do afplay beep-01a.wav; done
#log.txt this is the log file you want to tail. Full path if not in that directory
#'ERROR' is the stirng you are looking to match
#beep-01a.wav is the sound to play when string matched. Full path if not in that directory
#Maik later responded saying his logfile was on a remote server, he discovered the following worked to tail a remote file
ssh <user@remoteserver> tail -n 0 -f log.txt | grep --line-buffered 'ERROR' | while read line; do afplay beep-01a.wav; done
@FriendlyTester
FriendlyTester / gist:79e7d61ce418ed24cedb
Created October 16, 2014 11:16
C# - Proxy Using ChromeDriver
public void SettupUpAProxyUsingChromeDriver()
{
//Create a chrome options object
var chromeOptions = new ChromeOptions();
//Create a new proxy object
var proxy = new Proxy();
//Set the http proxy value, host and port.
proxy.HttpProxy = "localhost:8888";
//Set the proxy to the Chrome options
chromeOptions.Proxy = proxy;
@FriendlyTester
FriendlyTester / MinimizeWebDriver.java
Created April 25, 2020 17:07
Selenium Minimize Browser Window
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.time.Duration;
public class MinimizeWebDriver
@FriendlyTester
FriendlyTester / gist:897c776c1fcf14e627c8
Created October 16, 2014 11:04
C# Proxy Using Firefox Driver
public void SettingUpAProxyUsingFirefoxDriver()
{
//Create a new Firefox profile
var firefoxProfile = new FirefoxProfile();
//Create a new proxy object
var proxy = new Proxy();
//Set the http proxy value, host and port.
proxy.HttpProxy = "localhost:8888";
//We then add this proxt setting to the Firefox profile we created
firefoxProfile.SetProxyPreferences(proxy);
@FriendlyTester
FriendlyTester / AndroidRecord.sh
Created August 21, 2018 22:39
Record Android with ADB and Download the File
#!/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'"
@FriendlyTester
FriendlyTester / AndroidScreenshot.sh
Created August 21, 2018 22:34
ADB Take Screenshot and Pull It
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
function usage(){
echo -e "\nThis script will screenshot 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'"
@FriendlyTester
FriendlyTester / .java
Created April 30, 2017 21:08
Running Chrome Headlessly Using WebDriver
import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
BlogObject blogObject = new BlogObject (webDriver, 60);
//Inherit the DefaultPage.
public class BlogObject : DefaultPage
{
//Two parameters, base in your driver, and also the timeout for the page to finish loading.
public BlogObject(IWebDriver webDriver, double timeout)
: base(webDriver) //Pass the driver to the base class.
{
//Initiate the locators dictionary, and assign to private parameter.
_locators = Locators();