9
我目前使用Selenium Webdriver在页面上进行一些验证。 Webdriver由PhantomJS驱动。我知道在PhantomJS中,您可以使用以下示例收听网络:(从https://github.com/ariya/phantomjs/wiki/Network-Monitoring)。与Selenium Webdriver和Python一起使用PhantomJS
var page = require('webpage').create();
page.onResourceRequested = function (request) {
console.log('Request ' + JSON.stringify(request, undefined, 4));
};
page.onResourceReceived = function (response) {
console.log('Receive ' + JSON.stringify(response, undefined, 4));
};
page.open(url);
如何在Webdriver中实现此功能?我可以将函数绑定到DesiredCapabilities吗?
如何,这是一个Python的问题吗? – Marcin
[建议的解决方案对我来说不起作用,但是这个可以工作(它使用driver.execute_script)](http://stackoverflow.com/a/36427562/1334996) – AlexMe