How to use selenium NetworkInterceptor with RemoteWebDriver

60 Views Asked by At

Is there a way to use Selenium 4 NetworkInterceptor on CI using RemoteWebDriver?

URL seleniumHubUrl = null; // Selenium Hub URL
RemoteWebDriver driver = new RemoteWebDriver(seleniumHubUrl, new DesiredCapabilities())
new NetworkInterceptor(driver, (Filter) next -> next))

Results with DevTools Unable to create DevTools connection exception which make sense as RemoteWebDriver simply doesn't implement HasDevTools interface. Yet, it doesn't seem feasible to use ChromeDriver or ChromiumDriver instead of RemoteWebDriver as I can't pass selenium hub URL while constructing an instance.

Is there a way to work-around this so that I can mock request/response in tests that need to run regularly on CI?

0

There are 0 best solutions below