Is there a way to access values from the Network tab? Like for example everything under the Name column? Im using Selenium and am interested in monitoring the Network tab. Thanks
Asked
Active
Viewed 2,966 times
3
-
What are you interested in monitoring from the _Network_ Tab? – undetected Selenium Apr 03 '18 at 09:57
-
Possible duplicate of [how to access Network panel on google chrome developer tools with selenium?](https://stackoverflow.com/questions/20401264/how-to-access-network-panel-on-google-chrome-developer-tools-with-selenium) – Chanda Korat Apr 04 '18 at 12:35
-
https://stackoverflow.com/a/68363046/8491363 I did it in Python using Selenium. – user8491363 Jul 13 '21 at 13:29
2 Answers
1
In C# I'm using the following way:
Initializing driver:
var perfLogPrefs = new ChromePerformanceLoggingPreferences();
perfLogPrefs.AddTracingCategories(new string[] { "devtools.network", "devtools.timeline" });
options.PerformanceLoggingPreferences = perfLogPrefs;
options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
options.SetLoggingPreference("performance", LogLevel.All);
driver = new ChromeDriver(
ConfigManager.ChromeDriverPath, options);
ScenarioDefinitions.PathToGoogleCustomProfile = string.Empty;
Getting data from the logs:
var data = driver.Manage().Logs.GetLog("performance");
As a result - you would get a huge amount of json files with all the data. Translating this code from C# to Python, along with parsing the data you need from json shouldn't be that hard. Hope it helps.
Best Regards, Vitali.

Vital
- 91
- 1
- 6
-
Do you have any more details on the above? I am trying to find the path to specific files that get loaded during the page load and they show in the network tab. I am curious how to implement the above and what libraries are needed? – John Nov 24 '20 at 23:43
0
I did it in Python using Selenium
https://stackoverflow.com/a/68363046/8491363
The key is setting the performance log.
From Selenium 4.0 onward, the library officially support accessing Chrome devtool info so you can also use that instead.

user8491363
- 2,924
- 5
- 19
- 28