C#
0
Вклад в тег
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.DevTools;
class Program
{
static void Main(string[] args)
{
var options = new ChromeOptions();
options.AddArgument("--start-maximized");
IWebDriver driver = new ChromeDriver(options);
var xhrUrls = new List<string>();
var handler = new NetworkRequestHandler();
handler.RequestTransformer = (request) => { return request; };
handler.RequestMatcher = httprequest =>
{
xhrUrls.Add(httprequest.Url);
return false;
};
INetwork networkInterceptor = driver.Manage().Network;
networkInterceptor.AddRequestHandler(handler);
networkInterceptor.StartMonitoring();
driver.Navigate().GoToUrl("https://store.epicgames.com/en-US/p/tunche");
driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(30);
networkInterceptor.StopMonitoring();
foreach (var url in xhrUrls)
{
Console.WriteLine(url);
}
driver.Quit();
}
}