Skip to content

Instantly share code, notes, and snippets.

@gspncr
Created July 20, 2021 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gspncr/1b0577a02b1e3533b798e430a20c5471 to your computer and use it in GitHub Desktop.
Save gspncr/1b0577a02b1e3533b798e430a20c5471 to your computer and use it in GitHub Desktop.
Scripted Browser monitor script that will fail if the text “Log In” is present on the New Relic homepage:
// Scripted Browser monitor script that will fail if the text “Log In” is present on the New Relic homepage:
var assert = require('assert');
var URL = 'http://newrelic.com';
var textToFind = 'Log In';
$browser.get(URL).then(function(){
return $browser.findElement($driver.By.tagName('html')).getText();
}).then(function(body){
var textFound = (body.indexOf(textToFind) > -1);
assert.equal(textFound, false, '"' + textToFind + '" found on page.');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment