@@ -57,14 +57,18 @@ builder.selenium2.io.addLangFormatter({
5757 " } catch (err) { return false; }\n" +
5858 "}\n\n" +
5959 "function isElementSelected(el) { return $browser.findElement(el).isSelected(); }\n\n" +
60- "function isTextPresentIn(text, sourceEl) {\n" +
61- " return sourceEl.getText()\n" +
62- " .then(function (wholetext) {\n" +
63- " return wholetext.indexOf(text) != -1;\n" +
64- " });\n" +
60+ "function isTextPresentIn(text, selector) {\n" +
61+ " return $browser.findElement(selector)\n" +
62+ " .getText()\n" +
63+ " .then(function (wholetext) {\n" +
64+ " return wholetext.indexOf(text) != -1;\n" +
65+ " })\n" +
66+ " .catch(function(err) {\n" +
67+ " return false;\n" +
68+ " });\n" +
6569 "}\n\n" +
6670 "function isTextPresent(text) {\n" +
67- " return isTextPresentIn(text, $browser.findElement( By.tagName('html') ));\n" +
71+ " return isTextPresentIn(text, By.tagName('html'));\n" +
6872 "}\n\n" +
6973 "/** BEGINNING OF SCRIPT **/\n\n" +
7074 "console.log('Starting synthetics script: {scriptName}');\n" +
@@ -566,4 +570,4 @@ function scriptify_complex(logmsg, msg) {
566570 " return " + msg + "; })\n\n" ;
567571}
568572
569- if ( builder && builder . loader && builder . loader . loadNextMainScript ) { builder . loader . loadNextMainScript ( ) ; }
573+ if ( builder && builder . loader && builder . loader . loadNextMainScript ) { builder . loader . loadNextMainScript ( ) ; }
0 commit comments