Web sitemde chromedriver
işaretçisini içeren basit bir node
komut dosyası çalıştırıyorum, sayfanın altına doğru kaydırır ve iz trace.json
olarak yazar.ChromeDriver tarafından yazılmış trace.json nasıl kullanılır?
Bu dosya 30MB civarındadır.
Bu dosyayı chrome://tracing/
numaralı telefona yükleyemiyorum, profil verilerini görüntülemek için yapacağıma inanıyorum.
trace.json
dosyamdan anlam çıkarmak için seçeneklerim nelerdir?
'use strict';
var fs = require('fs');
var wd = require('wd');
var b = wd.promiseRemote('http://localhost:9515');
b.init({
browserName: 'chrome',
chromeOptions: {
perfLoggingPrefs: {
'traceCategories': 'toplevel,disabled-by-default-devtools.timeline.frame,blink.console,disabled-by-default-devtools.timeline,benchmark'
},
args: ['--enable-gpu-benchmarking', '--enable-thread-composting']
},
loggingPrefs: {
performance: 'ALL'
}
}).then(function() {
return b.get('http://www.example.com');
}).then(function() {
// We only want to measure interaction, so getting a log once here
// flushes any previous tracing logs we have.
return b.log('performance');
}).then(function() {
// Smooth scroll to bottom.
return b.execute(`
var height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight, document.documentElement.clientHeight);
chrome.gpuBenchmarking.smoothScrollBy(height, function(){});
`);
}).then(function() {
// Wait for the above action to complete.
return b.sleep(5000);
}).then(function() {
// Get all the trace logs since last time log('performance') was called.
return b.log('performance');
}).then(function (data) {
// Write the file to disk.
return fs.writeFileSync('trace.json', JSON.stringify(data.map(function (s) {
return JSON.parse(s.message); // This is needed since Selenium outputs logs as strings.
})));
}).fin(function() {
return b.quit();
}).done();
dosya mı doğru oluşturuldu? manuel olarak yükleyebiliyor musunuz? –
Elle yükleme nasıl yapılır? Dosyanın kendisi çok büyük, bu yüzden doğru bir şekilde üretildiğini söylemek zor, ama "görünüyor" tamam. Uygun JSON vb. – jerome
El ile yüklemek için: Chrome'u başlatın, chrome: // tracing/adresine gidin ve Yükle'ye tıklayın. –