Created
June 8, 2011 16:27
-
-
Save dtsn/1014764 to your computer and use it in GitHub Desktop.
Selenium Query to store a time so it can be checked against a select box with timeframes spaced at 5 minute intervals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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); | |
time = time.split(' ')[1]; | |
console.log(time); | |
time = time.replace(':', '.'); | |
console.log(time); | |
time = parseFloat(time); | |
console.log(time); | |
time = Math.floor((time*20) + 0.5)/20; | |
console.log(time); | |
time = time.toFixed(2); | |
console.log(time); | |
time = time.toString(); | |
console.log(time); | |
time = time.replace('.', ':'); | |
console.log(time); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment