Skip to content

Instantly share code, notes, and snippets.

@dtsn
dtsn / Selenium
Created June 8, 2011 16:27
Selenium Query to store a time so it can be checked against a select box with timeframes spaced at 5 minute intervals
/**
* Selenium Query to store a time so it can be checked against a select box with timeframes spaced at 5 minute intervals
*/
javascript{(Math.floor((parseFloat(this.browserbot.getCurrentWindow().document.getElementById('e_startTime').innerHTML.split(' ')[1].replace(':', '.'))*20) + 0.5)/20).toFixed(2).toString().replace('.', ':')}
// It's just doing this really
var time = document.getElementById('e_startTime').innerHTML;
console.log(time);
@dtsn
dtsn / Custom Exceptions.js
Created November 5, 2010 11:35
Custom Exceptions in JavaScript
function myExceptionHandler() {}
try {
throw new myExceptionHandler;
} catch (e) {
if (e instanceOf myExceptionHandler) {
// handle it
}
}