通过 DOM 获取 Ace 编辑器的内容



我正在使用Nightwatch.js对页面运行一些测试。我需要获取页面上的 Ace 编辑器的文本内容,以便我可以将其与某些 JSON 进行比较。

这可能吗?

提前感谢!

相反,我挂接到了页面的角度控制器,并从那里获取了我需要的数据:

'is the Splash-Live schema set up correctly?': function (client) {
    var pageSplashLive = client.page.pageSplashLive();
    var code;
    login(client);
    pageSplashLive.navigate()
      .waitForElementVisible('@jsonButton', 15000)
      .click('@jsonButton')
      .waitForElementVisible('.ace_content', 10000)
      .api.execute("return angular.element($('.data-editor-form')).scope()['ctrl']['selectedData']['schema']['properties'];", [], function(response) {
          code = JSON.stringify(response.value);
          console.log(code);
          client.assert.equal(code,
            'json_goes_here');
        });
},

最新更新