Hi,
I want to run a selenium test on my local machine and catch http traffic on different machine.
This is my script:
RemoteWebDriver driver;
ChromeOptions chromeOptions = new ChromeOptions();
FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default);
OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
proxy.HttpProxy = "{IP of the different machine}:8888";
chromeOptions.Proxy = proxy;
DesiredCapabilities capabilities = (DesiredCapabilities)chromeOptions.ToCapabilities();
driver = new RemoteWebDriver(new Uri({IP of the different machine}:4444/wd/hub), capabilities, TimeSpan.FromSeconds(600));
FiddlerApplication.AfterSessionComplete += CollectDataThroughProxy;
private static List<string> dataStr = new List<string>();
private static void CollectDataThroughProxy(Session sess)
{
if (sess == null || sess.oRequest == null || sess.oRequest.headers == null)
return;
string headers = sess.oRequest.headers.ToString();
var reqBody = sess.GetRequestBodyAsString();
dataStr.Add(reqBody);
}
When I change IP in the code and run it on my local machine, it works fine. However, when I change IP to different machine, I see the relevant page is open,but I don't get the http traffic from this machine.
I checked "allow remote computers to connect" in Fiddler options.
Can anyone please help me?
Thanks
I want to run a selenium test on my local machine and catch http traffic on different machine.
This is my script:
RemoteWebDriver driver;
ChromeOptions chromeOptions = new ChromeOptions();
FiddlerApplication.Startup(8888, FiddlerCoreStartupFlags.Default);
OpenQA.Selenium.Proxy proxy = new OpenQA.Selenium.Proxy();
proxy.HttpProxy = "{IP of the different machine}:8888";
chromeOptions.Proxy = proxy;
DesiredCapabilities capabilities = (DesiredCapabilities)chromeOptions.ToCapabilities();
driver = new RemoteWebDriver(new Uri({IP of the different machine}:4444/wd/hub), capabilities, TimeSpan.FromSeconds(600));
FiddlerApplication.AfterSessionComplete += CollectDataThroughProxy;
private static List<string> dataStr = new List<string>();
private static void CollectDataThroughProxy(Session sess)
{
if (sess == null || sess.oRequest == null || sess.oRequest.headers == null)
return;
string headers = sess.oRequest.headers.ToString();
var reqBody = sess.GetRequestBodyAsString();
dataStr.Add(reqBody);
}
When I change IP in the code and run it on my local machine, it works fine. However, when I change IP to different machine, I see the relevant page is open,but I don't get the http traffic from this machine.
I checked "allow remote computers to connect" in Fiddler options.
Can anyone please help me?
Thanks