Class BrowserNetworkProfileManager
java.lang.Object
com.shaft.gui.browser.internal.BrowserNetworkProfileManager
Applies browser network profiles through Selenium DevTools when the active driver supports them.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanblockResources(org.openqa.selenium.WebDriver driver, String... urlPatterns) Blocks browser requests whose URLs match the supplied DevTools patterns.static booleangoOffline(org.openqa.selenium.WebDriver driver) Enables offline browser networking.static booleanrestore(org.openqa.selenium.WebDriver driver) Restores default browser networking and clears blocked URL patterns.static booleanthrottle(org.openqa.selenium.WebDriver driver, long latencyMs, long downloadKbps, long uploadKbps) Applies fixed latency and throughput limits.
-
Method Details
-
goOffline
public static boolean goOffline(org.openqa.selenium.WebDriver driver) Enables offline browser networking.- Parameters:
driver- active WebDriver- Returns:
truewhen the profile was applied
-
restore
public static boolean restore(org.openqa.selenium.WebDriver driver) Restores default browser networking and clears blocked URL patterns.- Parameters:
driver- active WebDriver- Returns:
truewhen the profile was restored
-
throttle
public static boolean throttle(org.openqa.selenium.WebDriver driver, long latencyMs, long downloadKbps, long uploadKbps) Applies fixed latency and throughput limits.- Parameters:
driver- active WebDriverlatencyMs- network latency in millisecondsdownloadKbps- download throughput in kilobits per seconduploadKbps- upload throughput in kilobits per second- Returns:
truewhen the profile was applied
-
blockResources
Blocks browser requests whose URLs match the supplied DevTools patterns.- Parameters:
driver- active WebDriverurlPatterns- DevTools URL patterns- Returns:
truewhen the patterns were applied
-