Skip to content

Instantly share code, notes, and snippets.

@testingbot
testingbot / pion.go
Created December 23, 2020 15:47
pion
package net
import (
"context"
"fmt"
"io"
"bufio"
"log"
"os"
"time"
@testingbot
testingbot / csharp.cs
Created October 27, 2020 14:13
csharp example capabilities
using System;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.iOS;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;
namespace TestingBotAppiumSingleTest
{
class MainClass
@testingbot
testingbot / jest-puppeteer.js
Created March 25, 2020 16:29
Jest + Puppeteer
import 'expect-puppeteer'
describe('Google', () => {
beforeAll(async () => {
await page.goto('https://google.com')
})
it('should display "google" text on page', async () => {
await expect(page).toMatch('google')
})
@testingbot
testingbot / gist:dbfde9aae14797363b4722c4af0c392d
Created November 22, 2019 20:14
geckodriver android crash
geckodriver -p 3031 --log trace
1574453509206 geckodriver DEBUG Listening on 127.0.0.1:3031
1574453513007 webdriver::server DEBUG -> POST /session {"capabilities":{"firstMatch":[{"moz:firefoxOptions":{"androidPackage":"org.mozilla.firefox"}}]}}
1574453513007 mozdevice WARN adb server response contained hexstring length 98 and message length was 98 and message was "FA69L0313992 device usb:1-1 product:sailfish model:Pixel device:sailfish transport_id:7\n"
1574453513007 geckodriver::android DEBUG Android port forward (37267 -> 2829) started
1574453513008 mozdevice DEBUG execute_host_command: >> "host:transport:FA69L0313992"
1574453513008 mozdevice DEBUG execute_host_command: << []
1574453513008 mozdevice DEBUG execute_host_command: >> "shell:cmd package resolve-activity --brief org.mozilla.firefox | tail -n 1"
1574453513156 mozdevice DEBUG execute_host_command: << "org.mozilla.firefox/.App\n"
1574453513156 mozdevice DEBUG execute_host_command: >> "host:transport:FA69L0313992"
@testingbot
testingbot / fullpagescreenshot.cs
Created May 14, 2016 09:49
Full page screenshot with webdriver
public Image GetEntireScreenshot()
{
// Get the total size of the page
var totalWidth = (int) (long) ((IJavaScriptExecutor) driver).ExecuteScript("return document.body.offsetWidth"); //documentElement.scrollWidth");
var totalHeight = (int) (long) ((IJavaScriptExecutor) driver).ExecuteScript("return document.body.parentNode.scrollHeight");
// Get the size of the viewport
var viewportWidth = (int) (long) ((IJavaScriptExecutor) driver).ExecuteScript("return document.body.clientWidth"); //documentElement.scrollWidth");
var viewportHeight = (int) (long) ((IJavaScriptExecutor) driver).ExecuteScript("return window.innerHeight"); //documentElement.scrollWidth");
// We only care about taking multiple images together if it doesn't already fit
@testingbot
testingbot / example prerun
Created September 17, 2015 10:35
example prerun on testingbot
@echo off
echo "=========================================="
echo "======== Running prerun.bat file! ========"
echo "=========================================="
C:\test\wget.lnk --no-check-certificate "https://s3.amazonaws.com/xxx.jar" -O C:\test\mycode.jar
java -jar C:\test\mycode.jar
use Selenium::Remote::Driver;
#Input capabilities
my $extraCaps = {
"browser" => "internet explorer",
"version" => "7",
"platform" => "Windows"
};
my $key = "changeme";
@testingbot
testingbot / gist:7770538
Created December 3, 2013 14:59
lolcode
HAI
OBTW WE'RE GOING TO CALCULATE PI TODAY USING AN APPROXIMATION ALGORITHM CONSISTING OF CALCULATING THE SUM OF
THE FOLLOWING SERIES:
4 * SUM OF [ (-1)^k k ∈ N
2*k + 1 ]
WE GO UP TO K=1000
TLDR
@testingbot
testingbot / gist:5107065
Last active December 14, 2015 15:19
phpunit example with testingbot
<?php
require_once 'PHPUnit/Extensions/Selenium2TestCase.php';
classGUITest extends \PHPUnit_Extensions_Selenium2TestCase {
public function __construct() {
$key = '[your api key]';
$secret = '[your api secret]';
$this->setHost("$key:$secret@hub.testingbot.com");
$this->setPort(80);
@testingbot
testingbot / gist:3798926
Created September 28, 2012 09:49
fetch all links, store in cookie, fetch them again
/* Store */
var elements = this.getDocument().getElementsByTagName('a');
var links = [];
for (var i = 0; i < elements.length; i++) {
links.push(elements[i].href);
}
this.browserbot.createCookie("links", JSON.stringify(links));