Forum Discussion

detached31's avatar
Occasional Contributor
4 months ago

Difference in JavaScript support with TC 15.61

I have some code which retrieves a JavaScript variable (a boolean value) from a Web page, in a test script (JScript).

var oPerfs = Sys.Browser("*").WaitPage("*",10000).

This worked (always) with TestExecute with Chrome 121.0.6167. (and we then use the oPerfs variable to set the JavaScript variable to true, and activate some performance counters in the page, that we later retrieve from some JS variables in the ...web.galilei.features namespace).

This fails repeatedly with TestExecute with the same Chrome: 'sap' is null or not an object.

All the Chrome are using the 15.0.4 Smartbear Test Extension.

(as a side note, it fails with any version of TE with Chrome Beta 122)

Should it work?

5 Replies

  • rraghvani's avatar
    Champion Level 3

    Are you able to call *feature.performance in Chrome DevTools, and does it work?

  • detached31's avatar
    Occasional Contributor

    Yes, it works in DevTools. I see an object, with sub-objects: DebugCounter, Measure, Performance (again), logger, root...
    The following test script line does " = true;". And I can see this boolean in Chrome DevTools. (also in Firefox 122, or MS Edge 121)

  • detached31's avatar
    Occasional Contributor

    I have submitted a case on February, 9, which is still on-going.

    After some further tests, the behavior change happened between TC 15.57, and 15.58.

    I have submitted a simple reproduction case: a HTML page with some JavaScript elements:

    var globalVar = "global var";
    var obj = { "a": 20, "b" : function() { return "obj.b return"; } };
    var editedByEval = 10;
    function getSomeValue() { return "get some value"; }
    function setEditedByEval(val) { if (val != null) { editedByEval = val; } return editedByEval; }

    I'm loading the page with Chrome. And there is a JavaScript TestComplete script which accesses these elements (with value check, and exception processing removed):

    var page = Sys.Browser("*").WaitPage("*");
    var g = page.contentDocument.Script.globalVar;
    g = page.contentDocument.Script.obj.a;
    g = page.contentDocument.Script.getSomeValue();
    g = page.contentDocument.Script.obj.b();

    Starting with 15.58, all these elements under .Script, are undefined (which might trigger an exception when accessing a sub-object, e.g. ".Script.obj.a")

    • rraghvani's avatar
      Champion Level 3

      The functionality is broken in the latest version, but works fine in v15.55.53.7