我正在使用Titanium web proxy捕获浏览器的HAR流量以进行测试。
工作正常。但是问题在于,它在执行了两次之后一直保持超时,我不知道该怎么办。
我唯一可以检查的选项是确保在Proxy Server
中未选中Internet Options
。
这是我的代码:
var proxyServer = new ProxyServer
{
};
proxyServer.CertificateManager.TrustRootCertificate(true);
var explicitEndPoint = new ExplicitProxyEndPoint(System.Net.IPAddress.Any, 18882, true);
proxyServer.AddEndPoint(explicitEndPoint);
proxyServer.Start();
proxyServer.SetAsSystemHttpProxy(explicitEndPoint);
proxyServer.SetAsSystemHttpsProxy(explicitEndPoint);
proxyServer.BeforeRequest += OnRequestEventHandler;
proxyServer.BeforeResponse += OnResponseEventHandler;
var proxy = new OpenQA.Selenium.Proxy
{
HttpProxy = "http://localhost:18882",
SslProxy = "http://localhost:18882",
FtpProxy = "http://localhost:18882"
};
var options = new ChromeOptions
{
Proxy = proxy
};
driver = new ChromeDriver(options);
Helper.Login(driver);
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15);
var pages = new PageBusiness().GetPagesThatShouldBeAnalyzed();
foreach (var page in pages)
{
try
{
driver.Url = $"https://www.example.com/{page.Path}/";
var menu = driver.FindElement(By.CssSelector("#menu"));
menu.Click();
}
catch (Exception ex)
{
}
Thread.Sleep(10000);
}
proxyServer.Stop();
有什么想法吗?