2016-05-27 8 views
0

Nightwatch.jsを使用してページに対していくつかのテストを行っています。ページ上にあるAce Editorのテキストコンテンツを取得して、JSONと比較できるようにする必要があります。DOMを使ってAce Editorのコンテンツを入手する

これは可能ですか?

ありがとうございます!

答えて

0

は代わりに、私は、ページの角度コントローラに夢中、私はそこから必要なデータをつかん:

'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'); 
     }); 
}, 
関連する問題