2015-11-04 120 views
0

即時通信創建一個平臺,用戶自動化測試,以驗證小工具是否功能。我已經做了tutorials和看到了examples但我仍然可以找出發生了什麼。theintern測試框架 - 測試iframes

im試圖測試的小部件是用沒有src屬性的iframe製作的,用im試圖在沒有src屬性的情況下找到該iframe中的元素.define(function(require){registerId = require('intern !對象 '); VAR斷言=需要(' 實習生/柴斷言!');

registerSuite({ 
    name: 'index', 

    'greeting form': function() { 
     return this.remote 
      .get(require.toUrl('localhost:3000')) 
      .findById('iframeId') 
      .switchToFrame('iframeId') 
      .findById('buttonID'); 

    } 
}); 

});`

有了這個代碼,它發生的實習生亞軍返回一個錯誤說它無法找到該元素。但是,當我嘗試在具有「src」屬性的iframe上運行相同的代碼時,它會找到正確的元素,並且不會返回任何錯誤。

任何人都可以幫忙?

return this.remote 
    .get(require.toUrl('localhost:3000')) 
    .findById('iframeId') 
    .end() 
    .switchToFrame('iframeId') 
    .findById('buttonID') 

這是假設的findById呼叫等待的iframe被添加到:

回答

0

在上面的代碼,你應該嘗試在iframe中找到一個元素,像之前清除搜索上下文這一頁。如果你不需要這樣做,只需要撥打findById('iframeId'),你應該很好。