Permalink
Browse files

Better exception message again

  • Loading branch information...
tj committed Sep 3, 2010
1 parent 8509fe8 commit 11f2351c482a3beea06830d8f6721b2f067c194e
Showing with 5 additions and 8 deletions.
  1. +4 −7 examples/google.js
  2. +1 −1 lib/selenium/client.js
View
@@ -15,14 +15,11 @@ var browser = selenium.createClient({
browser.session(function(err){
browser.command('open', ['/'], function(err, res){
browser.command('type', ['q', 'Hello World'], function(err, res){
- browser.command('click', ['btnG'], function(err, res){
- browser.command('assertTitle', ['Google'], function(err, res){
+ browser.command('clickAndWait', ['btnG'], function(err, res){
+ browser.command('assertTitle', ['Hello World - Google Search'], function(err, res){
if (err) throw err;
- browser.command('assertTextPresent', ['Hello'], function(err, res){
- if (err) throw err;
- browser.command('testComplete', [], function(err, res){
- console.dir(res.body)
- });
+ browser.command('testComplete', [], function(err, res){
+ console.dir(res.body)
});
});
});
View
@@ -82,7 +82,7 @@ Client.prototype.command = function(cmd, args, fn){
res.on('end', function(){
if (res.body.indexOf('ERROR') === 0) {
var err = res.body.replace(/^ERROR: */, '');
- err = ['command:', cmd, args.join(', '), err].join(' ');
+ err = cmd + '(' + args.join(', ') + '): ' + err;
fn(new Error(err), res);
} else {
if (res.body.indexOf('OK') === 0) {

0 comments on commit 11f2351

Please sign in to comment.