Created
February 7, 2014 09:31
-
-
Save akshay-bhardwaj/8859706 to your computer and use it in GitHub Desktop.
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
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>'; | |
console.log(msg); | |
}); | |
db.transaction(function (tx) { | |
tx.executeSql('SELECT * FROM LOGS', [], function (tx, results) { | |
var len = results.rows.length, i; | |
msg = '<p>Found rows: ' + len + '</p>'; | |
var temp = temp + msg; | |
document.getElementsByTagName(\"body\")[0].innerHTML = temp; | |
console.log(temp); | |
console.warn(temp); | |
}, null); | |
}); | |
return true; | |
}; | |
tempFunc(); | |
" | |
puts "Return value #{ret_val}" | |
puts driver.title | |
# puts driver.manage.logs.get("browser").inspect | |
sleep 3 | |
driver.save_screenshot 'a.png' | |
`rm a.png` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment