Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Script Validation is very quiet


Hello all,

My question is: How can I test a browser script in such a way that if it is syntactically correct I can see the output of the validation test or values in the vars being used? Is this even possible as when I validate I don’t get much feedback from it…

I am currently working on automating a web login to an ASP web service page and would like see which elements of the page are called/used correctly or not as I am assume that is where my issue is with the failure of the validation…

Thanks for any help with this or some advice on how to handle that…


Hi, @Wren: This is typically accomplished with console.log() statements:

var By = $driver.By;
var until = $driver.until;
var assert = require('assert');

var rootUrl = '';

// Sample customer names
var customers = [ 'New Relic', 'Phil Weber', 'J. Bieber', 'T. Swiffer', 'A. Grande' ];

// Restaurants and items to order
var orders = [
  {"restaurant": "Beijing Express", "items": [4, 5, 9, 11]},
  {"restaurant": "Naan Sequitur", "items": [3, 2, 14, 6]}, 
  {"restaurant": "Czech Point", "items": [7, 5]},
  {"restaurant": "Hit Me Baby One More Thai", "items": [9, 10, 16, 3]},
  {"restaurant": "Curry Galore", "items": [4, 3, 15, 7]}, 
  {"restaurant": "Esther's German Saloon", "items": [6, 18]},
  {"restaurant": "Super Wonton Express", "items": [4, 5, 9, 11]},
  {"restaurant": "Curry Up", "items": [3, 2, 14, 6]}

// Select random customer
var customerId = Math.floor(Math.random() * 5);
var customerName = customers[customerId++];

// Select random restaurant order
var orderId = Math.floor(Math.random() * 8);
var order = orders[orderId++];

  .then(function() {
    return $browser.get(rootUrl + '/customer')
    .then(function() {
      return $browser.findElement('customerName'));
    .then(function(element) {
        console.log('Found customerName element');
        return element.sendKeys(customerName);
    .then(function() {
        $browser.findElement('address')).sendKeys('111 SW Fifth Ave #2800, Portland, OR 97205');
        console.log('Entered address');
}).then(function() {
    return $browser.get(rootUrl + '/')
      .then(function() {
        return $browser.findElement(By.linkText(;
      .then(function(element) {
        console.log('Found restaurant name');
      .then(function() {
        return order.items.forEach(orderItem);
}).then(function() {

}).then(function() {

function orderItem(item) {
  $browser.findElement(By.css('.fm-menu-list > ul > :nth-child(' + item + ') .icon-plus-sign'))
    .then(function(element) {
        function() {

When you run the script, the log entries appear below the validation screenshot:



Thanks @philweber. I will give this a shot in my work this week. I was glad to see that when I ran this example script of yours initially that I got output both related to the browser data and the extra in the log…makes me feel better to see additional information making out of my testing.


Let us know how you get on when you try adding some additional logging :smiley: