diff --git a/playwright/pom.xml b/playwright/pom.xml index 2c927d88c..05d283622 100644 --- a/playwright/pom.xml +++ b/playwright/pom.xml @@ -65,6 +65,10 @@ com.google.code.gson gson + + org.jspecify + jspecify + org.java-websocket Java-WebSocket @@ -99,4 +103,64 @@ driver-bundle + + + nullaway + + [21,) + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + nullaway-testCompile + test-compile + + testCompile + + + true + ${project.build.directory}/nullaway-test-classes + + com/microsoft/playwright/nullability/JSpecifyApiConsumer.java + + + -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED + -XDcompilePolicy=simple + --should-stop=ifError=FLOW + -XDaddTypeAnnotationsToSymbol=true + -Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:OnlyNullMarked=true -XepOpt:NullAway:JSpecifyMode=true + + + + com.google.errorprone + error_prone_core + ${error-prone.version} + + + com.uber.nullaway + nullaway + ${nullaway.version} + + + + + + + + + + diff --git a/playwright/src/main/java/com/microsoft/playwright/APIRequest.java b/playwright/src/main/java/com/microsoft/playwright/APIRequest.java index 5e0cc42c5..65986382a 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIRequest.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIRequest.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.nio.file.Path; import java.util.*; @@ -40,7 +41,7 @@ class NewContextOptions { * {@code http://localhost:3000/bar.html} * */ - public String baseURL; + public @Nullable String baseURL; /** * TLS Client Authentication allows the server to request a client certificate and verify it. * @@ -58,34 +59,34 @@ class NewContextOptions { *

NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ - public List clientCertificates; + public @Nullable List clientCertificates; /** * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ - public Map extraHTTPHeaders; + public @Nullable Map extraHTTPHeaders; /** * Whether to throw on response codes other than 2xx and 3xx. By default response object is returned for all status codes. */ - public Boolean failOnStatusCode; + public @Nullable Boolean failOnStatusCode; /** * Credentials for HTTP authentication. If * no origin is specified, the username and password are sent to any servers upon unauthorized responses. */ - public HttpCredentials httpCredentials; + public @Nullable HttpCredentials httpCredentials; /** * Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}. */ - public Boolean ignoreHTTPSErrors; + public @Nullable Boolean ignoreHTTPSErrors; /** * Maximum number of request redirects that will be followed automatically. An error will be thrown if the number is * exceeded. Defaults to {@code 20}. Pass {@code 0} to not follow redirects. This can be overwritten for each request * individually. */ - public Integer maxRedirects; + public @Nullable Integer maxRedirects; /** * Network proxy settings. */ - public Proxy proxy; + public @Nullable Proxy proxy; /** * Populates context with given storage state. This option can be used to initialize context with logged-in information * obtained via {@link com.microsoft.playwright.BrowserContext#storageState BrowserContext.storageState()} or {@link @@ -94,22 +95,22 @@ class NewContextOptions { * BrowserContext.storageState()} or {@link com.microsoft.playwright.APIRequestContext#storageState * APIRequestContext.storageState()} methods. */ - public String storageState; + public @Nullable String storageState; /** * Populates context with given storage state. This option can be used to initialize context with logged-in information * obtained via {@link com.microsoft.playwright.BrowserContext#storageState BrowserContext.storageState()}. Path to the * file with saved storage state. */ - public Path storageStatePath; + public @Nullable Path storageStatePath; /** * Maximum time in milliseconds to wait for the response. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable * timeout. */ - public Double timeout; + public @Nullable Double timeout; /** * Specific user agent to use in this context. */ - public String userAgent; + public @Nullable String userAgent; /** * Methods like {@link com.microsoft.playwright.APIRequestContext#get APIRequestContext.get()} take the base URL into @@ -257,6 +258,6 @@ default APIRequestContext newContext() { * * @since v1.16 */ - APIRequestContext newContext(NewContextOptions options); + APIRequestContext newContext(@Nullable NewContextOptions options); } diff --git a/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java b/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java index e7449fe26..6f2348cdf 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIRequestContext.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.nio.file.Path; @@ -46,7 +47,7 @@ class DisposeOptions { /** * The reason to be reported to the operations interrupted by the context disposal. */ - public String reason; + public @Nullable String reason; /** * The reason to be reported to the operations interrupted by the context disposal. @@ -60,12 +61,12 @@ class StorageStateOptions { /** * Set to {@code true} to include IndexedDB in the storage state snapshot. */ - public Boolean indexedDB; + public @Nullable Boolean indexedDB; /** * The file path to save the storage state to. If {@code path} is a relative path, then it is resolved relative to current * working directory. If no path is provided, storage state is still returned, but won't be saved to the disk. */ - public Path path; + public @Nullable Path path; /** * Set to {@code true} to include IndexedDB in the storage state snapshot. @@ -103,7 +104,7 @@ default APIResponse delete(String url) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse delete(String url, RequestOptions params); + APIResponse delete(String url, @Nullable RequestOptions params); /** * All responses returned by {@link com.microsoft.playwright.APIRequestContext#get APIRequestContext.get()} and similar * methods are stored in the memory, so that you can later call {@link com.microsoft.playwright.APIResponse#body @@ -123,7 +124,7 @@ default void dispose() { * * @since v1.16 */ - void dispose(DisposeOptions options); + void dispose(@Nullable DisposeOptions options); /** * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update * context cookies from the response. The method will automatically follow redirects. @@ -196,7 +197,7 @@ default APIResponse fetch(String urlOrRequest) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse fetch(String urlOrRequest, RequestOptions params); + APIResponse fetch(String urlOrRequest, @Nullable RequestOptions params); /** * Sends HTTP(S) request and returns its response. The method will populate request cookies from the context and update * context cookies from the response. The method will automatically follow redirects. @@ -269,7 +270,7 @@ default APIResponse fetch(Request urlOrRequest) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse fetch(Request urlOrRequest, RequestOptions params); + APIResponse fetch(Request urlOrRequest, @Nullable RequestOptions params); /** * Sends HTTP(S) GET request and returns its * response. The method will populate request cookies from the context and update context cookies from the response. The @@ -308,7 +309,7 @@ default APIResponse get(String url) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse get(String url, RequestOptions params); + APIResponse get(String url, @Nullable RequestOptions params); /** * Sends HTTP(S) HEAD request and returns its * response. The method will populate request cookies from the context and update context cookies from the response. The @@ -329,7 +330,7 @@ default APIResponse head(String url) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse head(String url, RequestOptions params); + APIResponse head(String url, @Nullable RequestOptions params); /** * Sends HTTP(S) PATCH request and returns * its response. The method will populate request cookies from the context and update context cookies from the response. @@ -350,7 +351,7 @@ default APIResponse patch(String url) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse patch(String url, RequestOptions params); + APIResponse patch(String url, @Nullable RequestOptions params); /** * Sends HTTP(S) POST request and returns its * response. The method will populate request cookies from the context and update context cookies from the response. The @@ -445,7 +446,7 @@ default APIResponse post(String url) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse post(String url, RequestOptions params); + APIResponse post(String url, @Nullable RequestOptions params); /** * Sends HTTP(S) PUT request and returns its * response. The method will populate request cookies from the context and update context cookies from the response. The @@ -466,7 +467,7 @@ default APIResponse put(String url) { * @param params Optional request parameters. * @since v1.16 */ - APIResponse put(String url, RequestOptions params); + APIResponse put(String url, @Nullable RequestOptions params); /** * Returns storage state for this request context, contains current cookies and local storage snapshot if it was passed to * the constructor. @@ -482,7 +483,7 @@ default String storageState() { * * @since v1.16 */ - String storageState(StorageStateOptions options); + String storageState(@Nullable StorageStateOptions options); /** * * diff --git a/playwright/src/main/java/com/microsoft/playwright/APIResponse.java b/playwright/src/main/java/com/microsoft/playwright/APIResponse.java index c52f1d31e..e72069b6a 100644 --- a/playwright/src/main/java/com/microsoft/playwright/APIResponse.java +++ b/playwright/src/main/java/com/microsoft/playwright/APIResponse.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.util.*; @@ -61,14 +62,14 @@ public interface APIResponse { * * @since v1.61 */ - SecurityDetails securityDetails(); + @Nullable SecurityDetails securityDetails(); /** * Returns the IP address and port of the server. Resolves to {@code null} if the server address is not available. For * redirected requests, returns the information for the last request in the redirect chain. * * @since v1.61 */ - ServerAddr serverAddr(); + @Nullable ServerAddr serverAddr(); /** * Contains the status code of the response (e.g., 200 for a success). * diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index f3d5a6a03..1318e1404 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.nio.file.Path; import java.util.*; @@ -69,7 +70,7 @@ class CloseOptions { /** * The reason to be reported to the operations interrupted by the browser closure. */ - public String reason; + public @Nullable String reason; /** * The reason to be reported to the operations interrupted by the browser closure. @@ -83,7 +84,7 @@ class NewContextOptions { /** * Whether to automatically download all the attachments. Defaults to {@code true} where all the downloads are accepted. */ - public Boolean acceptDownloads; + public @Nullable Boolean acceptDownloads; /** * When using {@link com.microsoft.playwright.Page#navigate Page.navigate()}, {@link com.microsoft.playwright.Page#route * Page.route()}, {@link com.microsoft.playwright.Page#waitForURL Page.waitForURL()}, {@link @@ -100,11 +101,11 @@ class NewContextOptions { * {@code http://localhost:3000/bar.html} * */ - public String baseURL; + public @Nullable String baseURL; /** * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ - public Boolean bypassCSP; + public @Nullable Boolean bypassCSP; /** * TLS Client Authentication allows the server to request a client certificate and verify it. * @@ -122,7 +123,7 @@ class NewContextOptions { *

NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ - public List clientCertificates; + public @Nullable List clientCertificates; /** * Emulates prefers-colors-scheme media @@ -130,121 +131,121 @@ class NewContextOptions { * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code * "light"}. */ - public Optional colorScheme; + public @Nullable Optional colorScheme; /** * Emulates {@code "prefers-contrast"} media feature, supported values are {@code "no-preference"}, {@code "more"}. See * {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public Optional contrast; + public @Nullable Optional contrast; /** * Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about emulating devices with device scale factor. */ - public Double deviceScaleFactor; + public @Nullable Double deviceScaleFactor; /** * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ - public Map extraHTTPHeaders; + public @Nullable Map extraHTTPHeaders; /** * Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link * com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation * to system defaults. Defaults to {@code "none"}. */ - public Optional forcedColors; - public Geolocation geolocation; + public @Nullable Optional forcedColors; + public @Nullable Geolocation geolocation; /** * Specifies if viewport supports touch events. Defaults to false. Learn more about mobile emulation. */ - public Boolean hasTouch; + public @Nullable Boolean hasTouch; /** * Credentials for HTTP authentication. If * no origin is specified, the username and password are sent to any servers upon unauthorized responses. */ - public HttpCredentials httpCredentials; + public @Nullable HttpCredentials httpCredentials; /** * Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}. */ - public Boolean ignoreHTTPSErrors; + public @Nullable Boolean ignoreHTTPSErrors; /** * Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device, * so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more * about mobile emulation. */ - public Boolean isMobile; + public @Nullable Boolean isMobile; /** * Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about disabling JavaScript. */ - public Boolean javaScriptEnabled; + public @Nullable Boolean javaScriptEnabled; /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default * locale. Learn more about emulation in our emulation guide. */ - public String locale; + public @Nullable String locale; /** * Whether to emulate network being offline. Defaults to {@code false}. Learn more about network emulation. */ - public Boolean offline; + public @Nullable Boolean offline; /** * A list of permissions to grant to all pages in this context. See {@link * com.microsoft.playwright.BrowserContext#grantPermissions BrowserContext.grantPermissions()} for more details. Defaults * to none. */ - public List permissions; + public @Nullable List permissions; /** * Network proxy settings to use with this context. Defaults to none. */ - public Proxy proxy; + public @Nullable Proxy proxy; /** * Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If * {@code attach} is specified, resources are persisted as separate files and all of these files are archived along with * the HAR file. Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification. */ - public HarContentPolicy recordHarContent; + public @Nullable HarContentPolicy recordHarContent; /** * When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page, * cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code * full}. */ - public HarMode recordHarMode; + public @Nullable HarMode recordHarMode; /** * Optional setting to control whether to omit request content from the HAR. Defaults to {@code false}. */ - public Boolean recordHarOmitContent; + public @Nullable Boolean recordHarOmitContent; /** * Enables HAR recording for all pages into the specified HAR * file on the filesystem. If not specified, the HAR is not recorded. Make sure to call {@link * com.microsoft.playwright.BrowserContext#close BrowserContext.close()} for the HAR to be saved. */ - public Path recordHarPath; - public Object recordHarUrlFilter; + public @Nullable Path recordHarPath; + public @Nullable Object recordHarUrlFilter; /** * Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure * to call {@link com.microsoft.playwright.BrowserContext#close BrowserContext.close()} for videos to be saved. */ - public Path recordVideoDir; + public @Nullable Path recordVideoDir; /** * Dimensions of the recorded videos. If not specified the size will be equal to {@code viewport} scaled down to fit into * 800x800. If {@code viewport} is not configured explicitly the video size defaults to 800x450. Actual picture of each * page will be scaled down if necessary to fit the specified size. */ - public RecordVideoSize recordVideoSize; + public @Nullable RecordVideoSize recordVideoSize; /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. * See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public Optional reducedMotion; + public @Nullable Optional reducedMotion; /** * Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code * viewport} is set. */ - public ScreenSize screenSize; + public @Nullable ScreenSize screenSize; /** * Whether to allow sites to register Service workers. Defaults to {@code "allow"}. *

*/ - public ServiceWorkerPolicy serviceWorkers; + public @Nullable ServiceWorkerPolicy serviceWorkers; /** * Populates context with given storage state. This option can be used to initialize context with logged-in information * obtained via {@link com.microsoft.playwright.BrowserContext#storageState BrowserContext.storageState()}. */ - public String storageState; + public @Nullable String storageState; /** * Populates context with given storage state. This option can be used to initialize context with logged-in information * obtained via {@link com.microsoft.playwright.BrowserContext#storageState BrowserContext.storageState()}. Path to the * file with saved storage state. */ - public Path storageStatePath; + public @Nullable Path storageStatePath; /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about * the strict mode. */ - public Boolean strictSelectors; + public @Nullable Boolean strictSelectors; /** * Changes the timezone of the context. See ICU's * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ - public String timezoneId; + public @Nullable String timezoneId; /** * Specific user agent to use in this context. */ - public String userAgent; + public @Nullable String userAgent; /** * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent * viewport emulation. Learn more about viewport @@ -290,7 +291,7 @@ class NewContextOptions { *

NOTE: The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the * operating system. It makes the execution of the tests non-deterministic. */ - public Optional viewportSize; + public @Nullable Optional viewportSize; /** * Whether to automatically download all the attachments. Defaults to {@code true} where all the downloads are accepted. @@ -354,7 +355,7 @@ public NewContextOptions setClientCertificates(List clientCer * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code * "light"}. */ - public NewContextOptions setColorScheme(ColorScheme colorScheme) { + public NewContextOptions setColorScheme(@Nullable ColorScheme colorScheme) { this.colorScheme = Optional.ofNullable(colorScheme); return this; } @@ -363,7 +364,7 @@ public NewContextOptions setColorScheme(ColorScheme colorScheme) { * {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public NewContextOptions setContrast(Contrast contrast) { + public NewContextOptions setContrast(@Nullable Contrast contrast) { this.contrast = Optional.ofNullable(contrast); return this; } @@ -387,7 +388,7 @@ public NewContextOptions setExtraHTTPHeaders(Map extraHTTPHeader * com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation * to system defaults. Defaults to {@code "none"}. */ - public NewContextOptions setForcedColors(ForcedColors forcedColors) { + public NewContextOptions setForcedColors(@Nullable ForcedColors forcedColors) { this.forcedColors = Optional.ofNullable(forcedColors); return this; } @@ -557,7 +558,7 @@ public NewContextOptions setRecordVideoSize(RecordVideoSize recordVideoSize) { * See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public NewContextOptions setReducedMotion(ReducedMotion reducedMotion) { + public NewContextOptions setReducedMotion(@Nullable ReducedMotion reducedMotion) { this.reducedMotion = Optional.ofNullable(reducedMotion); return this; } @@ -650,7 +651,7 @@ public NewContextOptions setViewportSize(int width, int height) { *

NOTE: The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the * operating system. It makes the execution of the tests non-deterministic. */ - public NewContextOptions setViewportSize(ViewportSize viewportSize) { + public NewContextOptions setViewportSize(@Nullable ViewportSize viewportSize) { this.viewportSize = Optional.ofNullable(viewportSize); return this; } @@ -659,7 +660,7 @@ class NewPageOptions { /** * Whether to automatically download all the attachments. Defaults to {@code true} where all the downloads are accepted. */ - public Boolean acceptDownloads; + public @Nullable Boolean acceptDownloads; /** * When using {@link com.microsoft.playwright.Page#navigate Page.navigate()}, {@link com.microsoft.playwright.Page#route * Page.route()}, {@link com.microsoft.playwright.Page#waitForURL Page.waitForURL()}, {@link @@ -676,11 +677,11 @@ class NewPageOptions { * {@code http://localhost:3000/bar.html} * */ - public String baseURL; + public @Nullable String baseURL; /** * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ - public Boolean bypassCSP; + public @Nullable Boolean bypassCSP; /** * TLS Client Authentication allows the server to request a client certificate and verify it. * @@ -698,7 +699,7 @@ class NewPageOptions { *

NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ - public List clientCertificates; + public @Nullable List clientCertificates; /** * Emulates prefers-colors-scheme media @@ -706,121 +707,121 @@ class NewPageOptions { * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code * "light"}. */ - public Optional colorScheme; + public @Nullable Optional colorScheme; /** * Emulates {@code "prefers-contrast"} media feature, supported values are {@code "no-preference"}, {@code "more"}. See * {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public Optional contrast; + public @Nullable Optional contrast; /** * Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about emulating devices with device scale factor. */ - public Double deviceScaleFactor; + public @Nullable Double deviceScaleFactor; /** * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ - public Map extraHTTPHeaders; + public @Nullable Map extraHTTPHeaders; /** * Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link * com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation * to system defaults. Defaults to {@code "none"}. */ - public Optional forcedColors; - public Geolocation geolocation; + public @Nullable Optional forcedColors; + public @Nullable Geolocation geolocation; /** * Specifies if viewport supports touch events. Defaults to false. Learn more about mobile emulation. */ - public Boolean hasTouch; + public @Nullable Boolean hasTouch; /** * Credentials for HTTP authentication. If * no origin is specified, the username and password are sent to any servers upon unauthorized responses. */ - public HttpCredentials httpCredentials; + public @Nullable HttpCredentials httpCredentials; /** * Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}. */ - public Boolean ignoreHTTPSErrors; + public @Nullable Boolean ignoreHTTPSErrors; /** * Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device, * so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more * about mobile emulation. */ - public Boolean isMobile; + public @Nullable Boolean isMobile; /** * Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about disabling JavaScript. */ - public Boolean javaScriptEnabled; + public @Nullable Boolean javaScriptEnabled; /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default * locale. Learn more about emulation in our emulation guide. */ - public String locale; + public @Nullable String locale; /** * Whether to emulate network being offline. Defaults to {@code false}. Learn more about network emulation. */ - public Boolean offline; + public @Nullable Boolean offline; /** * A list of permissions to grant to all pages in this context. See {@link * com.microsoft.playwright.BrowserContext#grantPermissions BrowserContext.grantPermissions()} for more details. Defaults * to none. */ - public List permissions; + public @Nullable List permissions; /** * Network proxy settings to use with this context. Defaults to none. */ - public Proxy proxy; + public @Nullable Proxy proxy; /** * Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If * {@code attach} is specified, resources are persisted as separate files and all of these files are archived along with * the HAR file. Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification. */ - public HarContentPolicy recordHarContent; + public @Nullable HarContentPolicy recordHarContent; /** * When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page, * cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code * full}. */ - public HarMode recordHarMode; + public @Nullable HarMode recordHarMode; /** * Optional setting to control whether to omit request content from the HAR. Defaults to {@code false}. */ - public Boolean recordHarOmitContent; + public @Nullable Boolean recordHarOmitContent; /** * Enables HAR recording for all pages into the specified HAR * file on the filesystem. If not specified, the HAR is not recorded. Make sure to call {@link * com.microsoft.playwright.BrowserContext#close BrowserContext.close()} for the HAR to be saved. */ - public Path recordHarPath; - public Object recordHarUrlFilter; + public @Nullable Path recordHarPath; + public @Nullable Object recordHarUrlFilter; /** * Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure * to call {@link com.microsoft.playwright.BrowserContext#close BrowserContext.close()} for videos to be saved. */ - public Path recordVideoDir; + public @Nullable Path recordVideoDir; /** * Dimensions of the recorded videos. If not specified the size will be equal to {@code viewport} scaled down to fit into * 800x800. If {@code viewport} is not configured explicitly the video size defaults to 800x450. Actual picture of each * page will be scaled down if necessary to fit the specified size. */ - public RecordVideoSize recordVideoSize; + public @Nullable RecordVideoSize recordVideoSize; /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. * See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public Optional reducedMotion; + public @Nullable Optional reducedMotion; /** * Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code * viewport} is set. */ - public ScreenSize screenSize; + public @Nullable ScreenSize screenSize; /** * Whether to allow sites to register Service workers. Defaults to {@code "allow"}. *

*/ - public ServiceWorkerPolicy serviceWorkers; + public @Nullable ServiceWorkerPolicy serviceWorkers; /** * Populates context with given storage state. This option can be used to initialize context with logged-in information * obtained via {@link com.microsoft.playwright.BrowserContext#storageState BrowserContext.storageState()}. */ - public String storageState; + public @Nullable String storageState; /** * Populates context with given storage state. This option can be used to initialize context with logged-in information * obtained via {@link com.microsoft.playwright.BrowserContext#storageState BrowserContext.storageState()}. Path to the * file with saved storage state. */ - public Path storageStatePath; + public @Nullable Path storageStatePath; /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about * the strict mode. */ - public Boolean strictSelectors; + public @Nullable Boolean strictSelectors; /** * Changes the timezone of the context. See ICU's * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ - public String timezoneId; + public @Nullable String timezoneId; /** * Specific user agent to use in this context. */ - public String userAgent; + public @Nullable String userAgent; /** * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent * viewport emulation. Learn more about viewport @@ -866,7 +867,7 @@ class NewPageOptions { *

NOTE: The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the * operating system. It makes the execution of the tests non-deterministic. */ - public Optional viewportSize; + public @Nullable Optional viewportSize; /** * Whether to automatically download all the attachments. Defaults to {@code true} where all the downloads are accepted. @@ -930,7 +931,7 @@ public NewPageOptions setClientCertificates(List clientCertif * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code * "light"}. */ - public NewPageOptions setColorScheme(ColorScheme colorScheme) { + public NewPageOptions setColorScheme(@Nullable ColorScheme colorScheme) { this.colorScheme = Optional.ofNullable(colorScheme); return this; } @@ -939,7 +940,7 @@ public NewPageOptions setColorScheme(ColorScheme colorScheme) { * {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public NewPageOptions setContrast(Contrast contrast) { + public NewPageOptions setContrast(@Nullable Contrast contrast) { this.contrast = Optional.ofNullable(contrast); return this; } @@ -963,7 +964,7 @@ public NewPageOptions setExtraHTTPHeaders(Map extraHTTPHeaders) * com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation * to system defaults. Defaults to {@code "none"}. */ - public NewPageOptions setForcedColors(ForcedColors forcedColors) { + public NewPageOptions setForcedColors(@Nullable ForcedColors forcedColors) { this.forcedColors = Optional.ofNullable(forcedColors); return this; } @@ -1133,7 +1134,7 @@ public NewPageOptions setRecordVideoSize(RecordVideoSize recordVideoSize) { * See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public NewPageOptions setReducedMotion(ReducedMotion reducedMotion) { + public NewPageOptions setReducedMotion(@Nullable ReducedMotion reducedMotion) { this.reducedMotion = Optional.ofNullable(reducedMotion); return this; } @@ -1226,7 +1227,7 @@ public NewPageOptions setViewportSize(int width, int height) { *

NOTE: The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the * operating system. It makes the execution of the tests non-deterministic. */ - public NewPageOptions setViewportSize(ViewportSize viewportSize) { + public NewPageOptions setViewportSize(@Nullable ViewportSize viewportSize) { this.viewportSize = Optional.ofNullable(viewportSize); return this; } @@ -1235,16 +1236,16 @@ class BindOptions { /** * Host to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. */ - public String host; + public @Nullable String host; /** * Port to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. Use * {@code 0} to let the OS pick an available port. */ - public Integer port; + public @Nullable Integer port; /** * Working directory associated with this browser server. */ - public String workspaceDir; + public @Nullable String workspaceDir; /** * Host to bind the web socket server to. When specified, a web socket server is created instead of a named pipe. @@ -1273,15 +1274,15 @@ class StartTracingOptions { /** * specify custom categories to use instead of default. */ - public List categories; + public @Nullable List categories; /** * A path to write the trace file to. */ - public Path path; + public @Nullable Path path; /** * captures screenshots in the trace. */ - public Boolean screenshots; + public @Nullable Boolean screenshots; /** * specify custom categories to use instead of default. @@ -1346,7 +1347,7 @@ default void close() { * * @since v1.8 */ - void close(CloseOptions options); + void close(@Nullable CloseOptions options); /** * Returns an array of all open browser contexts. In a newly created browser, this will return zero browser contexts. * @@ -1426,7 +1427,7 @@ default BrowserContext newContext() { * * @since v1.8 */ - BrowserContext newContext(NewContextOptions options); + BrowserContext newContext(@Nullable NewContextOptions options); /** * Creates a new page in a new browser context. Closing this page will close the context as well. * @@ -1450,7 +1451,7 @@ default Page newPage() { * * @since v1.8 */ - Page newPage(NewPageOptions options); + Page newPage(@Nullable NewPageOptions options); /** * Binds the browser to a named pipe or web socket, making it available for other clients to connect to. * @@ -1466,7 +1467,7 @@ default BindResult bind(String title) { * @param title Title of the browser server, used for identification. * @since v1.59 */ - BindResult bind(String title, BindOptions options); + BindResult bind(String title, @Nullable BindOptions options); /** * NOTE: This API controls Chromium Tracing * which is a low-level chromium-specific debugging tool. API to control NOTE: This API controls Chromium Tracing * which is a low-level chromium-specific debugging tool. API to control Defaults to abort. */ - public HarNotFound notFound; + public @Nullable HarNotFound notFound; /** * If specified, updates the given HAR with the actual network information instead of serving from file. The file is * written to disk when {@link com.microsoft.playwright.BrowserContext#close BrowserContext.close()} is called. */ - public Boolean update; + public @Nullable Boolean update; /** * Optional setting to control resource content management. If {@code attach} is specified, resources are persisted as * separate files or entries in the ZIP archive. If {@code embed} is specified, content is stored inline the HAR file. */ - public RouteFromHarUpdateContentPolicy updateContent; + public @Nullable RouteFromHarUpdateContentPolicy updateContent; /** * When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page, * cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code * minimal}. */ - public HarMode updateMode; + public @Nullable HarMode updateMode; /** * A glob pattern, regular expression or predicate to match the request URL. Only requests with URL matching the pattern * will be served from the HAR file. If not specified, all requests are served from the HAR file. */ - public Object url; + public @Nullable Object url; /** *

* @since v1.8 */ - void grantPermissions(List permissions, GrantPermissionsOptions options); + void grantPermissions(List permissions, @Nullable GrantPermissionsOptions options); /** * Indicates that the browser context is in the process of closing or has already been closed. * @@ -1096,7 +1097,7 @@ default AutoCloseable route(String url, Consumer handler) { * @param handler handler function to route the request. * @since v1.8 */ - AutoCloseable route(String url, Consumer handler, RouteOptions options); + AutoCloseable route(String url, Consumer handler, @Nullable RouteOptions options); /** * Routing provides the capability to modify network requests that are made by any page in the browser context. Once route * is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted. @@ -1206,7 +1207,7 @@ default AutoCloseable route(Pattern url, Consumer handler) { * @param handler handler function to route the request. * @since v1.8 */ - AutoCloseable route(Pattern url, Consumer handler, RouteOptions options); + AutoCloseable route(Pattern url, Consumer handler, @Nullable RouteOptions options); /** * Routing provides the capability to modify network requests that are made by any page in the browser context. Once route * is enabled, every request matching the url pattern will stall unless it's continued, fulfilled or aborted. @@ -1316,7 +1317,7 @@ default AutoCloseable route(Predicate url, Consumer handler) { * @param handler handler function to route the request. * @since v1.8 */ - AutoCloseable route(Predicate url, Consumer handler, RouteOptions options); + AutoCloseable route(Predicate url, Consumer handler, @Nullable RouteOptions options); /** * If specified the network requests that are made in the context will be served from the HAR file. Read more about Replaying from HAR. @@ -1344,7 +1345,7 @@ default void routeFromHAR(Path har) { * path} is a relative path, then it is resolved relative to the current working directory. * @since v1.23 */ - void routeFromHAR(Path har, RouteFromHAROptions options); + void routeFromHAR(Path har, @Nullable RouteFromHAROptions options); /** * This method allows to modify websocket connections that are made by any page in the browser context. * @@ -1483,7 +1484,7 @@ default void routeFromHAR(Path har) { * * @since v1.8 */ - void setGeolocation(Geolocation geolocation); + void setGeolocation(@Nullable Geolocation geolocation); /** * * @@ -1506,7 +1507,7 @@ default String storageState() { * * @since v1.8 */ - String storageState(StorageStateOptions options); + String storageState(@Nullable StorageStateOptions options); /** * Clears the existing cookies, local storage, IndexedDB entries and virtual WebAuthn credentials, and sets the new storage * state. When the storage state contains credentials, the virtual WebAuthn authenticator is installed (equivalent to @@ -1559,7 +1560,7 @@ default void unroute(String url) { * BrowserContext.route()}. * @since v1.8 */ - void unroute(String url, Consumer handler); + void unroute(String url, @Nullable Consumer handler); /** * Removes a route created with {@link com.microsoft.playwright.BrowserContext#route BrowserContext.route()}. When {@code * handler} is not specified, removes all routes for the {@code url}. @@ -1581,7 +1582,7 @@ default void unroute(Pattern url) { * BrowserContext.route()}. * @since v1.8 */ - void unroute(Pattern url, Consumer handler); + void unroute(Pattern url, @Nullable Consumer handler); /** * Removes a route created with {@link com.microsoft.playwright.BrowserContext#route BrowserContext.route()}. When {@code * handler} is not specified, removes all routes for the {@code url}. @@ -1603,7 +1604,7 @@ default void unroute(Predicate url) { * BrowserContext.route()}. * @since v1.8 */ - void unroute(Predicate url, Consumer handler); + void unroute(Predicate url, @Nullable Consumer handler); /** * The method will block until the condition returns true. All Playwright events will be dispatched while the method is * waiting for the condition. @@ -1651,7 +1652,7 @@ default void waitForCondition(BooleanSupplier condition) { * @param condition Condition to wait for. * @since v1.32 */ - void waitForCondition(BooleanSupplier condition, WaitForConditionOptions options); + void waitForCondition(BooleanSupplier condition, @Nullable WaitForConditionOptions options); /** * Performs action and waits for a {@code ConsoleMessage} to be logged by in the pages in the context. If predicate is * provided, it passes {@code ConsoleMessage} value into the {@code predicate} function and waits for {@code @@ -1673,7 +1674,7 @@ default ConsoleMessage waitForConsoleMessage(Runnable callback) { * @param callback Callback that performs the action triggering the event. * @since v1.34 */ - ConsoleMessage waitForConsoleMessage(WaitForConsoleMessageOptions options, Runnable callback); + ConsoleMessage waitForConsoleMessage(@Nullable WaitForConsoleMessageOptions options, Runnable callback); /** * Performs action and waits for a new {@code Page} to be created in the context. If predicate is provided, it passes * {@code Page} value into the {@code predicate} function and waits for {@code predicate(event)} to return a truthy value. @@ -1693,6 +1694,6 @@ default Page waitForPage(Runnable callback) { * @param callback Callback that performs the action triggering the event. * @since v1.9 */ - Page waitForPage(WaitForPageOptions options, Runnable callback); + Page waitForPage(@Nullable WaitForPageOptions options, Runnable callback); } diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index 305dd7fc5..d45cf09cc 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.nio.file.Path; import java.util.*; @@ -62,20 +63,20 @@ class ConnectOptions { *
  • {@code "*.test.internal-domain,*.staging.internal-domain,"} to expose test/staging deployments and localhost.
  • * */ - public String exposeNetwork; + public @Nullable String exposeNetwork; /** * Additional HTTP headers to be sent with web socket connect request. Optional. */ - public Map headers; + public @Nullable Map headers; /** * Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. * Defaults to 0. */ - public Double slowMo; + public @Nullable Double slowMo; /** * Maximum time in milliseconds to wait for the connection to be established. Defaults to {@code 0} (no timeout). */ - public Double timeout; + public @Nullable Double timeout; /** * This option exposes network available on the connecting client to the browser being connected to. Consists of a list of @@ -127,16 +128,16 @@ class ConnectOverCDPOptions { /** * If specified, browser artifacts (such as traces and downloads) are saved into this directory. */ - public Path artifactsDir; + public @Nullable Path artifactsDir; /** * Additional HTTP headers to be sent with connect request. Optional. */ - public Map headers; + public @Nullable Map headers; /** * Tells Playwright that it runs on the same host as the CDP server. It will enable certain optimizations that rely upon * the file system being the same between Playwright and the Browser. */ - public Boolean isLocal; + public @Nullable Boolean isLocal; /** * When true, Playwright will not apply its default overrides to the existing default browser context. Specifically, {@code * acceptDownloads} is left at the browser's setting, focus emulation is not enabled, and media emulation options (such as @@ -145,17 +146,17 @@ class ConnectOverCDPOptions { * contexts created via {@link com.microsoft.playwright.Browser#newContext Browser.newContext()} are not affected. Defaults * to {@code false}. */ - public Boolean noDefaults; + public @Nullable Boolean noDefaults; /** * Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. * Defaults to 0. */ - public Double slowMo; + public @Nullable Double slowMo; /** * Maximum time in milliseconds to wait for the connection to be established. Defaults to {@code 30000} (30 seconds). Pass * {@code 0} to disable timeout. */ - public Double timeout; + public @Nullable Double timeout; /** * If specified, browser artifacts (such as traces and downloads) are saved into this directory. @@ -215,13 +216,13 @@ class LaunchOptions { *

    Additional arguments to pass to the browser instance. The list of Chromium flags can be found here. */ - public List args; + public @Nullable List args; /** * If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory is not * cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the browser * closes. */ - public Path artifactsDir; + public @Nullable Path artifactsDir; /** * Browser distribution channel. * @@ -232,27 +233,27 @@ class LaunchOptions { * use branded Google Chrome and * Microsoft Edge. */ - public Object channel; + public @Nullable Object channel; /** * Enable Chromium sandboxing. Defaults to {@code false}. */ - public Boolean chromiumSandbox; + public @Nullable Boolean chromiumSandbox; /** * If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is * deleted when browser is closed. In either case, the downloads are deleted when the browser context they were created in * is closed. */ - public Path downloadsPath; + public @Nullable Path downloadsPath; /** * Specify environment variables that will be visible to the browser. Defaults to {@code process.env}. */ - public Map env; + public @Nullable Map env; /** * Path to a browser executable to run instead of the bundled one. If {@code executablePath} is a relative path, then it is * resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox * or WebKit, use at your own risk. */ - public Path executablePath; + public @Nullable Path executablePath; /** * Firefox user preferences. Learn more about the Firefox user preferences at {@code about:config}. @@ -260,52 +261,52 @@ class LaunchOptions { *

    You can also provide a path to a custom {@code policies.json} * file via {@code PLAYWRIGHT_FIREFOX_POLICIES_JSON} environment variable. */ - public Map firefoxUserPrefs; + public @Nullable Map firefoxUserPrefs; /** * Close the browser process on SIGHUP. Defaults to {@code true}. */ - public Boolean handleSIGHUP; + public @Nullable Boolean handleSIGHUP; /** * Close the browser process on Ctrl-C. Defaults to {@code true}. */ - public Boolean handleSIGINT; + public @Nullable Boolean handleSIGINT; /** * Close the browser process on SIGTERM. Defaults to {@code true}. */ - public Boolean handleSIGTERM; + public @Nullable Boolean handleSIGTERM; /** * Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to {@code true}. */ - public Boolean headless; + public @Nullable Boolean headless; /** * If {@code true}, Playwright does not pass its own configurations args and only uses the ones from {@code args}. * Dangerous option; use with care. Defaults to {@code false}. */ - public Boolean ignoreAllDefaultArgs; + public @Nullable Boolean ignoreAllDefaultArgs; /** * If {@code true}, Playwright does not pass its own configurations args and only uses the ones from {@code args}. * Dangerous option; use with care. */ - public List ignoreDefaultArgs; + public @Nullable List ignoreDefaultArgs; /** * Network proxy settings. */ - public Proxy proxy; + public @Nullable Proxy proxy; /** * Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. */ - public Double slowMo; + public @Nullable Double slowMo; /** * Maximum time in milliseconds to wait for the browser instance to start. Defaults to {@code 30000} (30 seconds). Pass * {@code 0} to disable timeout. */ - public Double timeout; + public @Nullable Double timeout; /** * If specified, traces are saved into this directory. */ - public Path tracesDir; + public @Nullable Path tracesDir; /** * NOTE: Use custom browser args at your own risk, as some of them may break Playwright functionality. @@ -484,20 +485,20 @@ class LaunchPersistentContextOptions { /** * Whether to automatically download all the attachments. Defaults to {@code true} where all the downloads are accepted. */ - public Boolean acceptDownloads; + public @Nullable Boolean acceptDownloads; /** * NOTE: Use custom browser args at your own risk, as some of them may break Playwright functionality. * *

    Additional arguments to pass to the browser instance. The list of Chromium flags can be found here. */ - public List args; + public @Nullable List args; /** * If specified, artifacts (traces, videos, downloads, HAR files, etc.) are saved into this directory. The directory is not * cleaned up when the browser closes. If not specified, a temporary directory is used and cleaned up when the browser * closes. */ - public Path artifactsDir; + public @Nullable Path artifactsDir; /** * When using {@link com.microsoft.playwright.Page#navigate Page.navigate()}, {@link com.microsoft.playwright.Page#route * Page.route()}, {@link com.microsoft.playwright.Page#waitForURL Page.waitForURL()}, {@link @@ -514,11 +515,11 @@ class LaunchPersistentContextOptions { * {@code http://localhost:3000/bar.html} * */ - public String baseURL; + public @Nullable String baseURL; /** * Toggles bypassing page's Content-Security-Policy. Defaults to {@code false}. */ - public Boolean bypassCSP; + public @Nullable Boolean bypassCSP; /** * Browser distribution channel. * @@ -529,11 +530,11 @@ class LaunchPersistentContextOptions { * use branded Google Chrome and * Microsoft Edge. */ - public Object channel; + public @Nullable Object channel; /** * Enable Chromium sandboxing. Defaults to {@code false}. */ - public Boolean chromiumSandbox; + public @Nullable Boolean chromiumSandbox; /** * TLS Client Authentication allows the server to request a client certificate and verify it. * @@ -551,7 +552,7 @@ class LaunchPersistentContextOptions { *

    NOTE: When using WebKit on macOS, accessing {@code localhost} will not pick up client certificates. You can make it work by * replacing {@code localhost} with {@code local.playwright}. */ - public List clientCertificates; + public @Nullable List clientCertificates; /** * Emulates prefers-colors-scheme media @@ -559,38 +560,38 @@ class LaunchPersistentContextOptions { * Page.emulateMedia()} for more details. Passing {@code null} resets emulation to system defaults. Defaults to {@code * "light"}. */ - public Optional colorScheme; + public @Nullable Optional colorScheme; /** * Emulates {@code "prefers-contrast"} media feature, supported values are {@code "no-preference"}, {@code "more"}. See * {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public Optional contrast; + public @Nullable Optional contrast; /** * Specify device scale factor (can be thought of as dpr). Defaults to {@code 1}. Learn more about emulating devices with device scale factor. */ - public Double deviceScaleFactor; + public @Nullable Double deviceScaleFactor; /** * If specified, accepted downloads are downloaded into this directory. Otherwise, temporary directory is created and is * deleted when browser is closed. In either case, the downloads are deleted when the browser context they were created in * is closed. */ - public Path downloadsPath; + public @Nullable Path downloadsPath; /** * Specify environment variables that will be visible to the browser. Defaults to {@code process.env}. */ - public Map env; + public @Nullable Map env; /** * Path to a browser executable to run instead of the bundled one. If {@code executablePath} is a relative path, then it is * resolved relative to the current working directory. Note that Playwright only works with the bundled Chromium, Firefox * or WebKit, use at your own risk. */ - public Path executablePath; + public @Nullable Path executablePath; /** * An object containing additional HTTP headers to be sent with every request. Defaults to none. */ - public Map extraHTTPHeaders; + public @Nullable Map extraHTTPHeaders; /** * Firefox user preferences. Learn more about the Firefox user preferences at {@code about:config}. @@ -598,134 +599,134 @@ class LaunchPersistentContextOptions { *

    You can also provide a path to a custom {@code policies.json} * file via {@code PLAYWRIGHT_FIREFOX_POLICIES_JSON} environment variable. */ - public Map firefoxUserPrefs; + public @Nullable Map firefoxUserPrefs; /** * Emulates {@code "forced-colors"} media feature, supported values are {@code "active"}, {@code "none"}. See {@link * com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation * to system defaults. Defaults to {@code "none"}. */ - public Optional forcedColors; - public Geolocation geolocation; + public @Nullable Optional forcedColors; + public @Nullable Geolocation geolocation; /** * Close the browser process on SIGHUP. Defaults to {@code true}. */ - public Boolean handleSIGHUP; + public @Nullable Boolean handleSIGHUP; /** * Close the browser process on Ctrl-C. Defaults to {@code true}. */ - public Boolean handleSIGINT; + public @Nullable Boolean handleSIGINT; /** * Close the browser process on SIGTERM. Defaults to {@code true}. */ - public Boolean handleSIGTERM; + public @Nullable Boolean handleSIGTERM; /** * Specifies if viewport supports touch events. Defaults to false. Learn more about mobile emulation. */ - public Boolean hasTouch; + public @Nullable Boolean hasTouch; /** * Whether to run browser in headless mode. More details for Chromium and Firefox. Defaults to {@code true}. */ - public Boolean headless; + public @Nullable Boolean headless; /** * Credentials for HTTP authentication. If * no origin is specified, the username and password are sent to any servers upon unauthorized responses. */ - public HttpCredentials httpCredentials; + public @Nullable HttpCredentials httpCredentials; /** * If {@code true}, Playwright does not pass its own configurations args and only uses the ones from {@code args}. * Dangerous option; use with care. Defaults to {@code false}. */ - public Boolean ignoreAllDefaultArgs; + public @Nullable Boolean ignoreAllDefaultArgs; /** * If {@code true}, Playwright does not pass its own configurations args and only uses the ones from {@code args}. * Dangerous option; use with care. */ - public List ignoreDefaultArgs; + public @Nullable List ignoreDefaultArgs; /** * Whether to ignore HTTPS errors when sending network requests. Defaults to {@code false}. */ - public Boolean ignoreHTTPSErrors; + public @Nullable Boolean ignoreHTTPSErrors; /** * Whether the {@code meta viewport} tag is taken into account and touch events are enabled. isMobile is a part of device, * so you don't actually need to set it manually. Defaults to {@code false} and is not supported in Firefox. Learn more * about mobile emulation. */ - public Boolean isMobile; + public @Nullable Boolean isMobile; /** * Whether or not to enable JavaScript in the context. Defaults to {@code true}. Learn more about disabling JavaScript. */ - public Boolean javaScriptEnabled; + public @Nullable Boolean javaScriptEnabled; /** * Specify user locale, for example {@code en-GB}, {@code de-DE}, etc. Locale will affect {@code navigator.language} value, * {@code Accept-Language} request header value as well as number and date formatting rules. Defaults to the system default * locale. Learn more about emulation in our emulation guide. */ - public String locale; + public @Nullable String locale; /** * Whether to emulate network being offline. Defaults to {@code false}. Learn more about network emulation. */ - public Boolean offline; + public @Nullable Boolean offline; /** * A list of permissions to grant to all pages in this context. See {@link * com.microsoft.playwright.BrowserContext#grantPermissions BrowserContext.grantPermissions()} for more details. Defaults * to none. */ - public List permissions; + public @Nullable List permissions; /** * Network proxy settings. */ - public Proxy proxy; + public @Nullable Proxy proxy; /** * Optional setting to control resource content management. If {@code omit} is specified, content is not persisted. If * {@code attach} is specified, resources are persisted as separate files and all of these files are archived along with * the HAR file. Defaults to {@code embed}, which stores content inline the HAR file as per HAR specification. */ - public HarContentPolicy recordHarContent; + public @Nullable HarContentPolicy recordHarContent; /** * When set to {@code minimal}, only record information necessary for routing from HAR. This omits sizes, timing, page, * cookies, security and other types of HAR information that are not used when replaying from HAR. Defaults to {@code * full}. */ - public HarMode recordHarMode; + public @Nullable HarMode recordHarMode; /** * Optional setting to control whether to omit request content from the HAR. Defaults to {@code false}. */ - public Boolean recordHarOmitContent; + public @Nullable Boolean recordHarOmitContent; /** * Enables HAR recording for all pages into the specified HAR * file on the filesystem. If not specified, the HAR is not recorded. Make sure to call {@link * com.microsoft.playwright.BrowserContext#close BrowserContext.close()} for the HAR to be saved. */ - public Path recordHarPath; - public Object recordHarUrlFilter; + public @Nullable Path recordHarPath; + public @Nullable Object recordHarUrlFilter; /** * Enables video recording for all pages into the specified directory. If not specified videos are not recorded. Make sure * to call {@link com.microsoft.playwright.BrowserContext#close BrowserContext.close()} for videos to be saved. */ - public Path recordVideoDir; + public @Nullable Path recordVideoDir; /** * Dimensions of the recorded videos. If not specified the size will be equal to {@code viewport} scaled down to fit into * 800x800. If {@code viewport} is not configured explicitly the video size defaults to 800x450. Actual picture of each * page will be scaled down if necessary to fit the specified size. */ - public RecordVideoSize recordVideoSize; + public @Nullable RecordVideoSize recordVideoSize; /** * Emulates {@code "prefers-reduced-motion"} media feature, supported values are {@code "reduce"}, {@code "no-preference"}. * See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public Optional reducedMotion; + public @Nullable Optional reducedMotion; /** * Emulates consistent window screen size available inside web page via {@code window.screen}. Is only used when the {@code * viewport} is set. */ - public ScreenSize screenSize; + public @Nullable ScreenSize screenSize; /** * Whether to allow sites to register Service workers. Defaults to {@code "allow"}. *

      @@ -734,37 +735,37 @@ class LaunchPersistentContextOptions { *
    • {@code "block"}: Playwright will block all registration of Service Workers.
    • *
    */ - public ServiceWorkerPolicy serviceWorkers; + public @Nullable ServiceWorkerPolicy serviceWorkers; /** * Slows down Playwright operations by the specified amount of milliseconds. Useful so that you can see what is going on. */ - public Double slowMo; + public @Nullable Double slowMo; /** * If set to true, enables strict selectors mode for this context. In the strict selectors mode all operations on selectors * that imply single target DOM element will throw when more than one element matches the selector. This option does not * affect any Locator APIs (Locators are always strict). Defaults to {@code false}. See {@code Locator} to learn more about * the strict mode. */ - public Boolean strictSelectors; + public @Nullable Boolean strictSelectors; /** * Maximum time in milliseconds to wait for the browser instance to start. Defaults to {@code 30000} (30 seconds). Pass * {@code 0} to disable timeout. */ - public Double timeout; + public @Nullable Double timeout; /** * Changes the timezone of the context. See ICU's * metaZones.txt for a list of supported timezone IDs. Defaults to the system timezone. */ - public String timezoneId; + public @Nullable String timezoneId; /** * If specified, traces are saved into this directory. */ - public Path tracesDir; + public @Nullable Path tracesDir; /** * Specific user agent to use in this context. */ - public String userAgent; + public @Nullable String userAgent; /** * Emulates consistent viewport for each page. Defaults to an 1280x720 viewport. Use {@code null} to disable the consistent * viewport emulation. Learn more about viewport @@ -773,7 +774,7 @@ class LaunchPersistentContextOptions { *

    NOTE: The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the * operating system. It makes the execution of the tests non-deterministic. */ - public Optional viewportSize; + public @Nullable Optional viewportSize; /** * Whether to automatically download all the attachments. Defaults to {@code true} where all the downloads are accepted. @@ -892,7 +893,7 @@ public LaunchPersistentContextOptions setClientCertificates(List fi * com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets emulation * to system defaults. Defaults to {@code "none"}. */ - public LaunchPersistentContextOptions setForcedColors(ForcedColors forcedColors) { + public LaunchPersistentContextOptions setForcedColors(@Nullable ForcedColors forcedColors) { this.forcedColors = Optional.ofNullable(forcedColors); return this; } @@ -1177,7 +1178,7 @@ public LaunchPersistentContextOptions setRecordVideoSize(RecordVideoSize recordV * See {@link com.microsoft.playwright.Page#emulateMedia Page.emulateMedia()} for more details. Passing {@code null} resets * emulation to system defaults. Defaults to {@code "no-preference"}. */ - public LaunchPersistentContextOptions setReducedMotion(ReducedMotion reducedMotion) { + public LaunchPersistentContextOptions setReducedMotion(@Nullable ReducedMotion reducedMotion) { this.reducedMotion = Optional.ofNullable(reducedMotion); return this; } @@ -1275,7 +1276,7 @@ public LaunchPersistentContextOptions setViewportSize(int width, int height) { *

    NOTE: The {@code null} value opts out from the default presets, makes viewport depend on the host window size defined by the * operating system. It makes the execution of the tests non-deterministic. */ - public LaunchPersistentContextOptions setViewportSize(ViewportSize viewportSize) { + public LaunchPersistentContextOptions setViewportSize(@Nullable ViewportSize viewportSize) { this.viewportSize = Optional.ofNullable(viewportSize); return this; } @@ -1301,7 +1302,7 @@ default Browser connect(String endpoint) { * @param endpoint A Playwright browser websocket endpoint to connect to. You obtain this endpoint via {@code BrowserServer.wsEndpoint}. * @since v1.8 */ - Browser connect(String endpoint, ConnectOptions options); + Browser connect(String endpoint, @Nullable ConnectOptions options); /** * This method attaches Playwright to an existing browser instance using the Chrome DevTools Protocol. * @@ -1357,7 +1358,7 @@ default Browser connectOverCDP(String endpointURL) { * ws://127.0.0.1:9222/devtools/browser/387adf4c-243f-4051-a181-46798f4a46f4}. * @since v1.9 */ - Browser connectOverCDP(String endpointURL, ConnectOverCDPOptions options); + Browser connectOverCDP(String endpointURL, @Nullable ConnectOverCDPOptions options); /** * A path where Playwright expects to find a bundled browser executable. * @@ -1433,7 +1434,7 @@ default Browser launch() { * * @since v1.8 */ - Browser launch(LaunchOptions options); + Browser launch(@Nullable LaunchOptions options); /** * Returns the persistent browser context instance. * @@ -1481,7 +1482,7 @@ default BrowserContext launchPersistentContext(Path userDataDir) { * as your automation profile instead. See https://developer.chrome.com/blog/remote-debugging-port for details. * @since v1.8 */ - BrowserContext launchPersistentContext(Path userDataDir, LaunchPersistentContextOptions options); + BrowserContext launchPersistentContext(Path userDataDir, @Nullable LaunchPersistentContextOptions options); /** * Returns browser name. For example: {@code "chromium"}, {@code "webkit"} or {@code "firefox"}. * diff --git a/playwright/src/main/java/com/microsoft/playwright/CDPSession.java b/playwright/src/main/java/com/microsoft/playwright/CDPSession.java index 1c137a4a2..7760ca63d 100644 --- a/playwright/src/main/java/com/microsoft/playwright/CDPSession.java +++ b/playwright/src/main/java/com/microsoft/playwright/CDPSession.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import java.util.function.Consumer; import com.google.gson.JsonObject; @@ -81,7 +82,7 @@ default JsonObject send(String method) { * @param args Optional method parameters. * @since v1.8 */ - JsonObject send(String method, JsonObject args); + JsonObject send(String method, @Nullable JsonObject args); /** * Register an event handler for events with the specified event name. The given handler will be called for every event * with the given name. diff --git a/playwright/src/main/java/com/microsoft/playwright/Clock.java b/playwright/src/main/java/com/microsoft/playwright/Clock.java index bab0a7f65..c70004e6c 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Clock.java +++ b/playwright/src/main/java/com/microsoft/playwright/Clock.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import java.util.Date; /** @@ -30,7 +31,7 @@ class InstallOptions { /** * Time to initialize with, current system time by default. */ - public Object time; + public @Nullable Object time; /** * Time to initialize with, current system time by default. @@ -129,7 +130,7 @@ default void install() { * * @since v1.45 */ - void install(InstallOptions options); + void install(@Nullable InstallOptions options); /** * Advance the clock, firing all the time-related callbacks. * diff --git a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java index db548f8be..8d88ddd71 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java +++ b/playwright/src/main/java/com/microsoft/playwright/ConsoleMessage.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import java.util.*; /** @@ -62,7 +63,7 @@ public interface ConsoleMessage { * * @since v1.34 */ - Page page(); + @Nullable Page page(); /** * The text of the console message. * @@ -90,6 +91,6 @@ public interface ConsoleMessage { * * @since v1.57 */ - Worker worker(); + @Nullable Worker worker(); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Credentials.java b/playwright/src/main/java/com/microsoft/playwright/Credentials.java index 5c3eb6d40..15d2cf098 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Credentials.java +++ b/playwright/src/main/java/com/microsoft/playwright/Credentials.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.util.*; @@ -87,19 +88,19 @@ class CreateOptions { /** * Base64url-encoded credential id. Auto-generated if omitted. */ - public String id; + public @Nullable String id; /** * Base64url-encoded PKCS#8 (DER) private key. Auto-generated if omitted. */ - public String privateKey; + public @Nullable String privateKey; /** * Base64url-encoded SPKI (DER) public key. Auto-generated if omitted. */ - public String publicKey; + public @Nullable String publicKey; /** * Base64url-encoded user handle. Auto-generated if omitted. */ - public String userHandle; + public @Nullable String userHandle; /** * Base64url-encoded credential id. Auto-generated if omitted. @@ -134,11 +135,11 @@ class GetOptions { /** * Only return the credential with this base64url-encoded id. */ - public String id; + public @Nullable String id; /** * Only return credentials for this relying party id. */ - public String rpId; + public @Nullable String rpId; /** * Only return the credential with this base64url-encoded id. @@ -203,7 +204,7 @@ default VirtualCredential create(String rpId) { * @param rpId Relying party id (typically the site's effective domain). * @since v1.61 */ - VirtualCredential create(String rpId, CreateOptions options); + VirtualCredential create(String rpId, @Nullable CreateOptions options); /** * Removes a credential from the authenticator by its id. Works for any credential currently held — both those seeded with * {@link com.microsoft.playwright.Credentials#create Credentials.create()} and those the page registered itself by calling @@ -238,6 +239,6 @@ default List get() { * * @since v1.61 */ - List get(GetOptions options); + List get(@Nullable GetOptions options); } diff --git a/playwright/src/main/java/com/microsoft/playwright/Debugger.java b/playwright/src/main/java/com/microsoft/playwright/Debugger.java index 9fbe29998..9d043c63b 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Debugger.java +++ b/playwright/src/main/java/com/microsoft/playwright/Debugger.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.util.*; @@ -39,7 +40,7 @@ public interface Debugger { * * @since v1.59 */ - DebuggerPausedDetails pausedDetails(); + @Nullable DebuggerPausedDetails pausedDetails(); /** * Configures the debugger to pause before the next action is executed. * diff --git a/playwright/src/main/java/com/microsoft/playwright/Dialog.java b/playwright/src/main/java/com/microsoft/playwright/Dialog.java index 3b187d52f..4d7ff391e 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Dialog.java +++ b/playwright/src/main/java/com/microsoft/playwright/Dialog.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; /** * {@code Dialog} objects are dispatched by page via the {@link com.microsoft.playwright.Page#onDialog Page.onDialog()} @@ -63,7 +64,7 @@ default void accept() { * @param promptText A text to enter in prompt. Does not cause any effects if the dialog's {@code type} is not prompt. Optional. * @since v1.8 */ - void accept(String promptText); + void accept(@Nullable String promptText); /** * If dialog is prompt, returns default prompt value. Otherwise, returns empty string. * @@ -87,7 +88,7 @@ default void accept() { * * @since v1.34 */ - Page page(); + @Nullable Page page(); /** * Returns dialog's type, can be one of {@code alert}, {@code beforeunload}, {@code confirm} or {@code prompt}. * diff --git a/playwright/src/main/java/com/microsoft/playwright/Download.java b/playwright/src/main/java/com/microsoft/playwright/Download.java index 490b32096..d76bd1e29 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Download.java +++ b/playwright/src/main/java/com/microsoft/playwright/Download.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import java.io.InputStream; import java.nio.file.Path; @@ -65,7 +66,7 @@ public interface Download { * * @since v1.8 */ - String failure(); + @Nullable String failure(); /** * Get the page that the download belongs to. * diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index 9fb77bcfa..53bd72438 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -16,6 +16,7 @@ package com.microsoft.playwright; +import org.jspecify.annotations.Nullable; import com.microsoft.playwright.options.*; import java.nio.file.Path; import java.util.*; @@ -63,36 +64,36 @@ class CheckOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the * element. */ - public Position position; + public @Nullable Position position; /** * Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"}, * which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code * "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This * is useful to assert that an element is reachable by the user without additional scrolling. */ - public ScrollMode scroll; + public @Nullable ScrollMode scroll; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * When set, this method only performs the actionability * checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without * performing it. */ - public Boolean trial; + public @Nullable Boolean trial; /** * Whether to bypass the actionability checks. Defaults to @@ -158,61 +159,61 @@ class ClickOptions { /** * Defaults to {@code left}. */ - public MouseButton button; + public @Nullable MouseButton button; /** * defaults to 1. See [UIEvent.detail]. */ - public Integer clickCount; + public @Nullable Integer clickCount; /** * Time to wait between {@code mousedown} and {@code mouseup} in milliseconds. Defaults to 0. */ - public Double delay; + public @Nullable Double delay; /** * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current * modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to "Control" on Windows * and Linux and to "Meta" on macOS. */ - public List modifiers; + public @Nullable List modifiers; /** * @deprecated This option will default to {@code true} in the future. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the * element. */ - public Position position; + public @Nullable Position position; /** * Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"}, * which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code * "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This * is useful to assert that an element is reachable by the user without additional scrolling. */ - public ScrollMode scroll; + public @Nullable ScrollMode scroll; /** * Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current * cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination * location. */ - public Integer steps; + public @Nullable Integer steps; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * When set, this method only performs the actionability * checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without * performing it. */ - public Boolean trial; + public @Nullable Boolean trial; /** * Defaults to {@code left}. @@ -317,57 +318,57 @@ class DblclickOptions { /** * Defaults to {@code left}. */ - public MouseButton button; + public @Nullable MouseButton button; /** * Time to wait between {@code mousedown} and {@code mouseup} in milliseconds. Defaults to 0. */ - public Double delay; + public @Nullable Double delay; /** * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current * modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to "Control" on Windows * and Linux and to "Meta" on macOS. */ - public List modifiers; + public @Nullable List modifiers; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the * element. */ - public Position position; + public @Nullable Position position; /** * Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"}, * which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code * "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This * is useful to assert that an element is reachable by the user without additional scrolling. */ - public ScrollMode scroll; + public @Nullable ScrollMode scroll; /** * Defaults to 1. Sends {@code n} interpolated {@code mousemove} events to represent travel between Playwright's current * cursor position and the provided destination. When set to 1, emits a single {@code mousemove} event at the destination * location. */ - public Integer steps; + public @Nullable Integer steps; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * When set, this method only performs the actionability * checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without * performing it. */ - public Boolean trial; + public @Nullable Boolean trial; /** * Defaults to {@code left}. @@ -466,18 +467,18 @@ class FillOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Whether to bypass the actionability checks. Defaults to @@ -510,42 +511,42 @@ class HoverOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current * modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to "Control" on Windows * and Linux and to "Meta" on macOS. */ - public List modifiers; + public @Nullable List modifiers; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the * element. */ - public Position position; + public @Nullable Position position; /** * Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"}, * which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code * "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This * is useful to assert that an element is reachable by the user without additional scrolling. */ - public ScrollMode scroll; + public @Nullable ScrollMode scroll; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * When set, this method only performs the actionability * checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without * performing it. */ - public Boolean trial; + public @Nullable Boolean trial; /** * Whether to bypass the actionability checks. Defaults to @@ -620,7 +621,7 @@ class InputValueOptions { /** * @deprecated This option is ignored. The value is returned immediately. */ - public Double timeout; + public @Nullable Double timeout; /** * @deprecated This option is ignored. The value is returned immediately. @@ -634,18 +635,18 @@ class PressOptions { /** * Time to wait between {@code keydown} and {@code keyup} in milliseconds. Defaults to 0. */ - public Double delay; + public @Nullable Double delay; /** * @deprecated This option will default to {@code true} in the future. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Time to wait between {@code keydown} and {@code keyup} in milliseconds. Defaults to 0. @@ -683,42 +684,42 @@ class ScreenshotOptions { * *

    Defaults to {@code "allow"} that leaves animations untouched. */ - public ScreenshotAnimations animations; + public @Nullable ScreenshotAnimations animations; /** * When set to {@code "hide"}, screenshot will hide text caret. When set to {@code "initial"}, text caret behavior will not * be changed. Defaults to {@code "hide"}. */ - public ScreenshotCaret caret; + public @Nullable ScreenshotCaret caret; /** * Specify locators that should be masked when the screenshot is taken. Masked elements will be overlaid with a pink box * {@code #FF00FF} (customized by {@code maskColor}) that completely covers its bounding box. The mask is also applied to * invisible elements, see Matching only * visible elements to disable that. */ - public List mask; + public @Nullable List mask; /** * Specify the color of the overlay box for masked elements, in CSS color format. Default color is pink {@code * #FF00FF}. */ - public String maskColor; + public @Nullable String maskColor; /** * Hides default white background and allows capturing screenshots with transparency. Not applicable to {@code jpeg} * images. Defaults to {@code false}. */ - public Boolean omitBackground; + public @Nullable Boolean omitBackground; /** * The file path to save the image to. The screenshot type will be inferred from file extension. If {@code path} is a * relative path, then it is resolved relative to the current working directory. If no path is provided, the image won't be * saved to the disk. */ - public Path path; + public @Nullable Path path; /** * The quality of the image, between 0-100. Not applicable to {@code png} images. For {@code jpeg} the default is {@code * 80}. For {@code webp}, a quality of {@code 100} (the default) produces a lossless image, while lower values use lossy * compression. */ - public Integer quality; + public @Nullable Integer quality; /** * When set to {@code "css"}, screenshot will have a single pixel per each css pixel on the page. For high-dpi devices, * this will keep screenshots small. Using {@code "device"} option will produce a single pixel per each device pixel, so @@ -726,24 +727,24 @@ class ScreenshotOptions { * *

    Defaults to {@code "device"}. */ - public ScreenshotScale scale; + public @Nullable ScreenshotScale scale; /** * Text of the stylesheet to apply while making the screenshot. This is where you can hide dynamic elements, make elements * invisible or change their properties to help you creating repeatable screenshots. This stylesheet pierces the Shadow DOM * and applies to the inner frames. */ - public String style; + public @Nullable String style; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Specify screenshot type, defaults to {@code png}. */ - public ScreenshotType type; + public @Nullable ScreenshotType type; /** * When set to {@code "disabled"}, stops CSS animations, CSS transitions and Web Animations. Animations get different @@ -857,7 +858,7 @@ class ScrollIntoViewIfNeededOptions { * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default @@ -875,18 +876,18 @@ class SelectOptionOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Whether to bypass the actionability checks. Defaults to @@ -919,14 +920,14 @@ class SelectTextOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Whether to bypass the actionability checks. Defaults to @@ -952,36 +953,36 @@ class SetCheckedOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the * element. */ - public Position position; + public @Nullable Position position; /** * Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"}, * which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code * "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This * is useful to assert that an element is reachable by the user without additional scrolling. */ - public ScrollMode scroll; + public @Nullable ScrollMode scroll; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * When set, this method only performs the actionability * checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without * performing it. */ - public Boolean trial; + public @Nullable Boolean trial; /** * Whether to bypass the actionability checks. Defaults to @@ -1047,14 +1048,14 @@ class SetInputFilesOptions { /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * @deprecated This option has no effect. @@ -1079,42 +1080,42 @@ class TapOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * Modifier keys to press. Ensures that only these modifiers are pressed during the operation, and then restores current * modifiers back. If not specified, currently pressed modifiers are used. "ControlOrMeta" resolves to "Control" on Windows * and Linux and to "Meta" on macOS. */ - public List modifiers; + public @Nullable List modifiers; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the * element. */ - public Position position; + public @Nullable Position position; /** * Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"}, * which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code * "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This * is useful to assert that an element is reachable by the user without additional scrolling. */ - public ScrollMode scroll; + public @Nullable ScrollMode scroll; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * When set, this method only performs the actionability * checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without * performing it. */ - public Boolean trial; + public @Nullable Boolean trial; /** * Whether to bypass the actionability checks. Defaults to @@ -1189,18 +1190,18 @@ class TypeOptions { /** * Time to wait between key presses in milliseconds. Defaults to 0. */ - public Double delay; + public @Nullable Double delay; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Time to wait between key presses in milliseconds. Defaults to 0. @@ -1232,36 +1233,36 @@ class UncheckOptions { * Whether to bypass the actionability checks. Defaults to * {@code false}. */ - public Boolean force; + public @Nullable Boolean force; /** * @deprecated This option has no effect. */ - public Boolean noWaitAfter; + public @Nullable Boolean noWaitAfter; /** * A point to use relative to the top-left corner of element padding box. If not specified, uses some visible point of the * element. */ - public Position position; + public @Nullable Position position; /** * Controls whether Playwright scrolls the element into view before performing the action. Defaults to {@code "auto"}, * which scrolls the element into view when necessary, including scrolling nested scrollable containers. When set to {@code * "none"}, Playwright does not scroll the element and the action fails if the element is not already in the viewport. This * is useful to assert that an element is reachable by the user without additional scrolling. */ - public ScrollMode scroll; + public @Nullable ScrollMode scroll; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * When set, this method only performs the actionability * checks and skips the action. Defaults to {@code false}. Useful to wait until the element is ready for the action without * performing it. */ - public Boolean trial; + public @Nullable Boolean trial; /** * Whether to bypass the actionability checks. Defaults to @@ -1330,7 +1331,7 @@ class WaitForElementStateOptions { * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default @@ -1355,19 +1356,19 @@ class WaitForSelectorOptions { * visibility:hidden}. This is opposite to the {@code "visible"} option. * */ - public WaitForSelectorState state; + public @Nullable WaitForSelectorState state; /** * When true, the call requires selector to resolve to a single element. If given selector resolves to more than one * element, the call throws an exception. */ - public Boolean strict; + public @Nullable Boolean strict; /** * Maximum time in milliseconds. Defaults to {@code 30000} (30 seconds). Pass {@code 0} to disable timeout. The default * value can be changed by using the {@link com.microsoft.playwright.BrowserContext#setDefaultTimeout * BrowserContext.setDefaultTimeout()} or {@link com.microsoft.playwright.Page#setDefaultTimeout Page.setDefaultTimeout()} * methods. */ - public Double timeout; + public @Nullable Double timeout; /** * Defaults to {@code "visible"}. Can be either: @@ -1425,7 +1426,7 @@ public WaitForSelectorOptions setTimeout(double timeout) { * * @since v1.8 */ - BoundingBox boundingBox(); + @Nullable BoundingBox boundingBox(); /** * This method checks the element by performing the following steps: *

      @@ -1467,7 +1468,7 @@ default void check() { * * @since v1.8 */ - void check(CheckOptions options); + void check(@Nullable CheckOptions options); /** * This method clicks the element by performing the following steps: *
        @@ -1507,13 +1508,13 @@ default void click() { * * @since v1.8 */ - void click(ClickOptions options); + void click(@Nullable ClickOptions options); /** * Returns the content frame for element handles referencing iframe nodes, or {@code null} otherwise * * @since v1.8 */ - Frame contentFrame(); + @Nullable Frame contentFrame(); /** * This method double clicks the element by performing the following steps: *
          @@ -1555,7 +1556,7 @@ default void dblclick() { * * @since v1.8 */ - void dblclick(DblclickOptions options); + void dblclick(@Nullable DblclickOptions options); /** * The snippet below dispatches the {@code click} event on the element. Regardless of the visibility state of the element, * {@code click} is dispatched. This is equivalent to calling actionability checks, focuses the * element, fills it and triggers an {@code input} event after filling. Note that you can pass an empty string to clear the @@ -1778,7 +1779,7 @@ default void fill(String value) { * @param value Value to set for the {@code }, {@code