Skip to content

Instantly share code, notes, and snippets.

View akloeber's full-sized avatar

Andreas Klöber akloeber

View GitHub Profile
<button id="downloadBtn">Download</button>
<script>
document.getElementById('downloadBtn').addEventListener('click', () => {
const a = document.createElement('a');
a.href = 'data:text/plain;base64,ZXhhbXBsZSBkYXRhCg==';
a.target = '_parent';
a.download = 'example.txt';
(document.body || document.documentElement).appendChild(a);
a.click();
a.remove();
node_modules/.bin/wdio wdio.conf.js --spec test/bug_getHTML.js
Debugger listening on [::]:5859
(node:68068) DeprecationWarning: `DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/vMUyr)
[13:42:14] COMMAND POST "/wd/hub/session"
[13:42:14] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":1,"browserName":"chrome","chromeOptions":{"args":["--disable-web-security","--start-fullscreen"],"prefs":{"credentials_enable_service":false,"profile":{"password_manager_enabled":false}}},"loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.6.2","name":"webdriverio"}}}
[13:42:15] INFO SET SESSION ID 0b77af1c-be50-4fee-a2dc-cf6354a67e5f
[13:42:15] RESULT {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":true,"chrome":{"chromedriverVersion":"2.29.461585 (0be2cd95f834e
suite('suite', function () {
setup(function () {
browser.addCommand('extractDataRow', function (rowIdx) {
const rows = this.elements('tr');
return rows.value[rowIdx];
});
browser.addCommand('extractDataRowCss', function (rowIdx) {
return this.element(`tr:nth-of-type(${rowIdx + 1})`);
$ node_modules/.bin/wdio wdio.conf.js --spec test/wdio-bug.js
Debugger listening on [::]:5859
(node:68089) DeprecationWarning: `DEBUG_FD` is deprecated. Override `debug.log` if you want to use a different log function (https://git.io/vMUyr)
[13:43:34] COMMAND POST "/wd/hub/session"
[13:43:34] DATA {"desiredCapabilities":{"javascriptEnabled":true,"locationContextEnabled":true,"handlesAlerts":true,"rotatable":true,"maxInstances":1,"browserName":"chrome","chromeOptions":{"args":["--disable-web-security","--start-fullscreen"],"prefs":{"credentials_enable_service":false,"profile":{"password_manager_enabled":false}}},"loggingPrefs":{"browser":"ALL","driver":"ALL"},"requestOrigins":{"url":"http://webdriver.io","version":"4.6.2","name":"webdriverio"}}}
[13:43:35] INFO SET SESSION ID 0d597d40-d987-44c7-83b7-194f730af761
[13:43:35] RESULT {"applicationCacheEnabled":false,"rotatable":false,"mobileEmulationEnabled":false,"networkConnectionEnabled":true,"chrome":{"chromedriverVersion":"2.29.461585 (0be2cd95f834e9
{
"schema_version": "2.0",
"packages": [{
"name": "EsFormatter",
"details": "https://github.com/akloeber/sublime-esformatter",
"releases": [{
"sublime_text": "*",
"details": "https://github.com/akloeber/sublime-esformatter"
}]
@akloeber
akloeber / pre-commit-eslint
Last active January 29, 2017 11:37 — forked from linhmtran168/pre-commit-eslint
Pre-commit hook to check for Javascript using ESLint
# see lint-js.sh in repository https://bitbucket.org/akloeber/git-hooks
@akloeber
akloeber / pm2.log
Created March 7, 2015 19:59
PM2 watch issue
Running tests:
#####################
# Watch for changes #
#####################
>server-watch.js
$pm2 kill
[PM2] Spawning PM2 daemon
@akloeber
akloeber / lodash.bug.js
Last active August 29, 2015 14:08
test case for lodash bug
var _ = require('lodash');
var assert = require('assert');
var a = [
/foo/,
/bar/
];
var t = 'bar';
// these work
@akloeber
akloeber / data.json
Created May 2, 2014 15:41
Request data for reproducing influxdb issue 493 (see https://github.com/influxdb/influxdb/issues/493)
[{"name":"eod","columns":["time","value"],"points":[[126000000,629.11],[385200000,628.48],[471600000,622.38],[558000000,623.38],[644400000,623.83],[730800000,618.7],[990000000,612.89],[1076400000,607.28],[1162800000,602.11],[1249200000,591.69],[1335600000,581.76],[1594800000,579.79],[1681200000,580.76],[1767600000,590.17],[1854000000,592.92],[1940400000,590.17],[2199600000,590.84],[2286000000,592.55],[2372400000,593.33],[2458800000,584.52],[2545200000,582.17],[2804400000,574.55],[2890800000,571.65],[2977200000,575.96],[3063600000,576.22],[3150000000,583.55],[3409200000,585.48],[3582000000,580.98],[3668400000,582.51],[3754800000,580.39],[4014000000,576.37],[4100400000,576.41],[4186800000,571.31],[4273200000,576.48],[4359600000,576.04],[4618800000,577.41],[4705200000,575.11],[4791600000,569.79],[4878000000,567.63],[4964400000,564.54],[5223600000,558.59],[5310000000,549.37],[5396400000,553.39],[5482800000,558.7],[5569200000,561.27],[5828400000,551.04],[5914800000,555.1],[6001200000,560.01],[6087600000,568.52],[6
var webdriverjs = require('webdriverjs'),
assert = require('assert');
describe('my webdriverjs tests', function(){
this.timeout(99999999);
var client = {};
before(function(done){
client = webdriverjs.remote({ desiredCapabilities: {browserName: 'phantomjs'} });