Skip to content

Instantly share code, notes, and snippets.

View FriendlyTester's full-sized avatar

Richard Bradshaw FriendlyTester

View GitHub Profile
@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 / 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;
@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 / ANdrewGist.java
Last active August 29, 2015 14:23
AndrewGist
public class UserBuilder
{
private User;
public UserBuilder()
{
User = new User();
user.setFirstName("Richard");
user.setSurname("Bradshaw");
user.setAge(29);
public UserChecks
{
public void DataCreation()
{
User user = UserBuilder().buildGenericUser();
user.setSurname("Richards");
user.setAge(35);
UserCreator.create(user);
}
}
@FriendlyTester
FriendlyTester / OPBManipulation.java
Last active August 29, 2015 14:23
Manipulations the output form the builder
public UserChecks
{
public void DataCreation()
{
User user = UserBuilder().buildGenericUser();
user.setSurname("Richards");
user.setAge(35);
}
}
@FriendlyTester
FriendlyTester / DBPPersonaBuilder.java
Created June 23, 2015 22:05
A persona builder example
public class UserBuilder
{
public User buildGenericUser()
{
User user = new User();
user.setFirstName("Richard");
user.setSurname("Bradshaw");
user.setAge(29);
user.setEmailAddress("[email protected]");
return user;
@FriendlyTester
FriendlyTester / DBPGenericBuilder.java
Created June 23, 2015 22:01
A simple builder method
public class UserBuilder
{
public User buildGenericUser()
{
User user = new User();
user.setFirstName("Richard");
user.setSurname("Bradshaw");
user.setAge(29);
user.setEmailAddress("[email protected]");
return user;