2017-06-04 33 views
-1

我在使用夜間測試進行測試時遇到以下錯誤。無法使用其編號找到夜間元素

預期元素是可見的 - 元素沒有被發現 - 預計「看得見」,但有「未找到」

我有以下兩個文件: -

頁的對象模型(simpleLogin.js)

module.exports = { 
 
\t url: 'http://google.com', 
 
\t sections :{ 
 
\t \t google: { 
 
\t \t selector:'div#fkbx', 
 
\t \t elements: { 
 
\t \t \t searchBar :{ 
 
\t \t \t \t selector : 'input[type=text]' 
 
\t \t \t }, 
 
\t \t \t 
 
\t \t \t searchButton :{ 
 
\t \t \t \t selector : 'button[name=btnG]' 
 
\t \t \t }, 
 
\t \t } 
 
\t \t } 
 
\t } 
 
};

測試JS

module.exports = { 
 
    'Test': function (client) { 
 
    var homepage = client.page.simpleLogin(); 
 
\t homepage.navigate() 
 
\t homepage.expect.section('@google').to.be.visible; 
 
    var googleSection = homepage.section.google; 
 
\t client.end(); 
 
    } 
 
};

任何人可以幫助我解決這個問題?

回答

0

用下面的代碼試試吧,讓我知道它是否工作:

module.exports = { 
url: 'http://google.com', 
sections: { 

google: { 

    selector: 'div#fkbx', 

    elements: { 
    searchBar: { 
     selector: 'input[type=text]', 
    }, 
    searchButton: { 
     selector: 'button[name=btnG]', 
    }, 
    }, 
    }, 
}, 
}; 

另外,請看看 this link,看看它是否能幫助你一點。