Initializes a new instance of the class. The instance on which the network should be monitored.
(IWebDriver driver)
| 37 | /// </summary> |
| 38 | /// <param name="driver">The <see cref="IWebDriver"/> instance on which the network should be monitored.</param> |
| 39 | [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Warnings are added to StartMonitoring and StopMonitoring")] |
| 40 | [UnconditionalSuppressMessage("Trimming", "IL3050", Justification = "Warnings are added to StartMonitoring and StopMonitoring")] |
| 41 | public NetworkManager(IWebDriver driver) |
| 42 | { |
| 43 | // Use of Lazy<T> means this exception won't be thrown until the user first |
| 44 | // attempts to access the DevTools session, probably on the first call to |
| 45 | // StartMonitoring(). |
| 46 | this.session = new Lazy<DevToolsSession>(() => |
| 47 | { |
| 48 | if (driver is not IDevTools devToolsDriver) |
| 49 | { |
| 50 | throw new WebDriverException("Driver must implement IDevTools to use these features"); |
| 51 | } |
| 52 | |
| 53 | return devToolsDriver.GetDevToolsSession(); |
| 54 | }); |
| 55 | } |
| 56 | |
| 57 | /// <summary> |
| 58 | /// Occurs when a browser sends a network request. |
nothing calls this directly
no test coverage detected