1

I can do this using Fetch commands in Java but I am not able to do it using C#. Does anyone has some sample snippet?

IDevTools devTools = driver as IDevTools;
var session = devTools.GetDevToolsSession();

var domains = session.GetVersionSpecificDomains<DevToolsSessionDomains>();

domains.Fetch.Enable(new OpenQA.Selenium.DevTools.V108.Fetch.EnableCommandSettings());

When I try to use Fetch in C#, I don't see it accepting RequestPattern as parameter and moving forward I need to add a listener for Fetch.requestPaused. Any help in this regard would be appreciated.

ashutosh
  • 45
  • 4
  • So you are performing UI Automation via Selenium (which is awesome) and yet you still wish to mock HTTP responses? If you are doing testing against the UI in the same way a human would you shouldn't care about the nitty gritty underlying HTTP responses anyway. Just screen scrape. –  Dec 15 '22 at 22:44
  • I am trying to test negative scenarios wherein if API returns other than 200 like 500, what would be the behavior of the application – ashutosh Dec 16 '22 at 11:16

0 Answers0