1
A
回答
2
不完全是由开发工具开放,但发现了一些网络,性能和其他结果。
是的,你可以做到这一点使用JavascriptExecutor
代码是如下: -
ChromeOptions options = new ChromeOptions();
options.addArguments("start-maximized");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(capabilities);
driver.get("http://www.google.com");
String scriptToExecute = "var performance = window.performance || window.mozPerformance || window.msPerformance || window.webkitPerformance || {}; var network = performance.getEntries() || {}; return network;";
String netData = ((JavascriptExecutor)driver).executeScript(scriptToExecute).toString();
System.out.println(netData);
OR
DesiredCapabilities d = DesiredCapabilities.chrome();
LoggingPreferences logPrefs = new LoggingPreferences();
logPrefs.enable(LogType.PERFORMANCE, Level.ALL);
d.setCapability(CapabilityType.LOGGING_PREFS, logPrefs);
WebDriver driver = new ChromeDriver(d);
driver.get("https://www.google.co.in/");
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
LogEntries les = driver.manage().logs().get(LogType.PERFORMANCE);
for (LogEntry le : les) {
System.out.println(le.getMessage());
}
因为这样做的第一个代码retrun网络return network;"
JS标签。您可以删除实体的JS代码,您不需要
第二个代码返回perfromance
希望它会帮助你:)
相关问题
- 1. Python网络刮硒/请求
- 2. CIL如何使用网络/ http请求?
- 3. 如何获得SoapUI请求在网络服务器上工作
- 4. 如何让硒查看网络浏览器发出的网络请求?
- 5. 如何获得请求头使用网站在导轨5 API
- 6. 如何获得http请求
- 7. 油门cpu使用的网络请求
- 8. 使用API的网络请求
- 9. 如何使用TestNG和硒网格获取Omniture 1 * 1图像请求参数
- 10. 如何拦截网络请求
- 11. Ajax获取wsdl网络服务请求
- 12. 多网络请求&网络客户端
- 13. 获取硒请求,回应
- 14. 如何通过网络执行网络请求?
- 15. 硒/硒网格:如何发布请求到不同的IP地址的网络服务器
- 16. 如何获得使用硒的webdriver
- 17. 如何使用硒获得链接href?
- 18. 如何使用Volley网络请求队列?
- 19. 如何在使用VCR/WebMock时允许网络请求?
- 20. 如何使用刷新令牌请求设计网络层?
- 21. 如何使用moya重新启动网络请求,rxswift
- 22. 如何获取“类型”的请求 - 网络服务(ASMX)
- 23. 如何获取请求网络连接的当前URL?
- 24. 如何在进行网络请求时获取验证码?
- 25. 如何获取由HTML完成的网络请求列表
- 26. Sharepoint如何获取外部网络服务的请求
- 27. 如何自动化API获取数据请求?当使用网络套接字
- 28. 嗅探网络请求
- 29. Safari 8网络请求空
- 30. GET网络请求参数
你在找这样的:HTTPS://www.openhub。 net/p/selenium-profiler? –
另一种方式 - 使用代理捕获所有网络活动,在快速搜索中我找到了这个:https://github.com/lightbody/browsermob-proxy –