Rozwiązanie:
module.exports = {
'Check getting log messages' : function (client) {
client
.url('http://jsbin.com/rohilugegi/1/')
.getLogTypes(function(result) {
console.log(result);
})
.getLog('browser', function(result) {
console.log(result);
})
;
return client;
},
To da wyświetlamy
[Start] Test Suite
==================
Running: Check getting log messages
[ 'har', 'browser', 'client', 'server' ]
[ { message: 'Test error\n error (:0)',
timestamp: 1428447687315,
level: 'WARNING' },
{ message: 'Test log (:)',
timestamp: 1428447687315,
level: 'INFO' } ]
No assertions ran.
Commands getLogTypes i getLog są już wdrażane w client commands ale ich opis są nieobecne na stronie API
Wygląda na to, że warto odczytu kodu źródłowego zamiast dokumentacji
Poniżej JSDoc do tej funkcji z kodu źródłowego:
/**
* Gets the available log types
*
* ```
* this.demoTest = function(client) {
* this.getLogTypes(function(typesArray) {
*
* });
* };
* ```
*
* @method getLogTypes
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @api commands
* @see logTypes
*/
i
/**
* Gets a log from selenium
*
* ```
* this.demoTest = function(client) {
* this.getLog('browser', function(logEntriesArray) {
* console.log("Log length: " + logEntriesArray.length);
* logEntriesArray.forEach(function(log) {
* console.log("[" + log.level + "] " + log.timestamp + " : " + log.message);
* });
* });
* };
* ```
*
* @method getLog
* @param {string} typeString Log type to request
* @param {function} [callback] Optional callback function to be called when the command finishes.
* @api commands
* @see log
*/
dostaję pusty dziennika przy użyciu tej techniki z Chrome. Z której przeglądarki korzystasz? Masz jakieś sugestie? –
Używam chromu i fantomu. Czy ręcznie sprawdziłeś konsolę? –
Ten pojemnik został utworzony anonimowo, a jego bezpłatny czas podglądu wygasł - po prostu utwórz kolejny do testu. –