Skip to content

Instantly share code, notes, and snippets.

import urllib2
import base64
USERNAME = ""
BROWSERSTACK_KEY = ""
BUILD = ""
SESSION = ""
def get_screen_shot(BUILD, SESSION):
req = urllib2.Request('https://www.browserstack.com/automate/builds/%s/sessions/%s/logs.json'%(BUILD, SESSION))
package juto;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
var webdriver = require('browserstack-webdriver'),
fs = require('fs');
// Input capabilities
var capabilities = {
'browserName' : 'firefox',
'browserstack.user' : '<username>',
'browserstack.key' : '<key>'
}
var webdriver = require('browserstack-webdriver'),
fs = require('fs');
// Input capabilities
var capabilities = {
'browserName' : 'firefox',
'browserstack.user' : '<username>',
'browserstack.key' : '<access_key>'
}
import org.openqa.selenium.By;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
var tempFunc = function(){
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, \"foobar\")');
tx.executeSql('INSERT INTO LOGS (id, log) VALUES (2, \"logmsg\")');
msg = '<p>Log message created and row inserted.</p>';
console.log(msg);
});
db.transaction(function (tx) {
def webSqlTest(driver)
driver.get("http://www.google.com")
ret_val = driver.execute_script "
var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
var tempFunc = function(){
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, \"foobar\")');
tx.executeSql('INSERT INTO LOGS (id, log) VALUES (2, \"logmsg\")');
msg = '<p>Log message created and row inserted.</p>';
/*
* require, fs, wd, assert, colors
* saves screenshot in current folder as hello.png
*/
var fs = require('fs');
module.exports = function helloBrowserStack(browser, cb) {
browser.get("http://www.google.com", function() {
browser.title(function(err, title) {
/*
* Copyright Akshay Bhardway, 2014
* Node.js wd browserstack sample with screenshot taking and saving it locally
*/
var webdriver = require('wd')
, assert = require('assert')
, colors = require('colors')
, fs = require('fs');
require 'time'
bs_response_time_arr = []
client_request_time_arr = []
flag = true
prev_request_time = nil
prev_response_time = nil
class Array
def avg
return 0 if self.length == 0
self.inject(0.0){|x,y| x + y} / self.length