diff --git a/playwright/src/main/java/com/microsoft/playwright/Browser.java b/playwright/src/main/java/com/microsoft/playwright/Browser.java index 23cd7a35..361c1ce8 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Browser.java +++ b/playwright/src/main/java/com/microsoft/playwright/Browser.java @@ -163,114 +163,114 @@ public interface Browser extends AutoCloseable { */ public Optional viewportSize; - public NewContextOptions withAcceptDownloads(boolean acceptDownloads) { + public NewContextOptions setAcceptDownloads(boolean acceptDownloads) { this.acceptDownloads = acceptDownloads; return this; } - public NewContextOptions withBypassCSP(boolean bypassCSP) { + public NewContextOptions setBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; return this; } - public NewContextOptions withColorScheme(ColorScheme colorScheme) { + public NewContextOptions setColorScheme(ColorScheme colorScheme) { this.colorScheme = colorScheme; return this; } - public NewContextOptions withDeviceScaleFactor(double deviceScaleFactor) { + public NewContextOptions setDeviceScaleFactor(double deviceScaleFactor) { this.deviceScaleFactor = deviceScaleFactor; return this; } - public NewContextOptions withExtraHTTPHeaders(Map extraHTTPHeaders) { + public NewContextOptions setExtraHTTPHeaders(Map extraHTTPHeaders) { this.extraHTTPHeaders = extraHTTPHeaders; return this; } - public NewContextOptions withGeolocation(double latitude, double longitude) { - return withGeolocation(new Geolocation(latitude, longitude)); + public NewContextOptions setGeolocation(double latitude, double longitude) { + return setGeolocation(new Geolocation(latitude, longitude)); } - public NewContextOptions withGeolocation(Geolocation geolocation) { + public NewContextOptions setGeolocation(Geolocation geolocation) { this.geolocation = geolocation; return this; } - public NewContextOptions withHasTouch(boolean hasTouch) { + public NewContextOptions setHasTouch(boolean hasTouch) { this.hasTouch = hasTouch; return this; } - public NewContextOptions withHttpCredentials(String username, String password) { - return withHttpCredentials(new HttpCredentials(username, password)); + public NewContextOptions setHttpCredentials(String username, String password) { + return setHttpCredentials(new HttpCredentials(username, password)); } - public NewContextOptions withHttpCredentials(HttpCredentials httpCredentials) { + public NewContextOptions setHttpCredentials(HttpCredentials httpCredentials) { this.httpCredentials = httpCredentials; return this; } - public NewContextOptions withIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { + public NewContextOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { this.ignoreHTTPSErrors = ignoreHTTPSErrors; return this; } - public NewContextOptions withIsMobile(boolean isMobile) { + public NewContextOptions setIsMobile(boolean isMobile) { this.isMobile = isMobile; return this; } - public NewContextOptions withJavaScriptEnabled(boolean javaScriptEnabled) { + public NewContextOptions setJavaScriptEnabled(boolean javaScriptEnabled) { this.javaScriptEnabled = javaScriptEnabled; return this; } - public NewContextOptions withLocale(String locale) { + public NewContextOptions setLocale(String locale) { this.locale = locale; return this; } - public NewContextOptions withOffline(boolean offline) { + public NewContextOptions setOffline(boolean offline) { this.offline = offline; return this; } - public NewContextOptions withPermissions(List permissions) { + public NewContextOptions setPermissions(List permissions) { this.permissions = permissions; return this; } - public NewContextOptions withProxy(String server) { - return withProxy(new Proxy(server)); + public NewContextOptions setProxy(String server) { + return setProxy(new Proxy(server)); } - public NewContextOptions withProxy(Proxy proxy) { + public NewContextOptions setProxy(Proxy proxy) { this.proxy = proxy; return this; } - public NewContextOptions withRecordHarOmitContent(boolean recordHarOmitContent) { + public NewContextOptions setRecordHarOmitContent(boolean recordHarOmitContent) { this.recordHarOmitContent = recordHarOmitContent; return this; } - public NewContextOptions withRecordHarPath(Path recordHarPath) { + public NewContextOptions setRecordHarPath(Path recordHarPath) { this.recordHarPath = recordHarPath; return this; } - public NewContextOptions withRecordVideoDir(Path recordVideoDir) { + public NewContextOptions setRecordVideoDir(Path recordVideoDir) { this.recordVideoDir = recordVideoDir; return this; } - public NewContextOptions withRecordVideoSize(int width, int height) { - return withRecordVideoSize(new RecordVideoSize(width, height)); + public NewContextOptions setRecordVideoSize(int width, int height) { + return setRecordVideoSize(new RecordVideoSize(width, height)); } - public NewContextOptions withRecordVideoSize(RecordVideoSize recordVideoSize) { + public NewContextOptions setRecordVideoSize(RecordVideoSize recordVideoSize) { this.recordVideoSize = recordVideoSize; return this; } - public NewContextOptions withStorageState(String storageState) { + public NewContextOptions setStorageState(String storageState) { this.storageState = storageState; return this; } - public NewContextOptions withStorageStatePath(Path storageStatePath) { + public NewContextOptions setStorageStatePath(Path storageStatePath) { this.storageStatePath = storageStatePath; return this; } - public NewContextOptions withTimezoneId(String timezoneId) { + public NewContextOptions setTimezoneId(String timezoneId) { this.timezoneId = timezoneId; return this; } - public NewContextOptions withUserAgent(String userAgent) { + public NewContextOptions setUserAgent(String userAgent) { this.userAgent = userAgent; return this; } - public NewContextOptions withViewportSize(int width, int height) { - return withViewportSize(new ViewportSize(width, height)); + public NewContextOptions setViewportSize(int width, int height) { + return setViewportSize(new ViewportSize(width, height)); } - public NewContextOptions withViewportSize(ViewportSize viewportSize) { + public NewContextOptions setViewportSize(ViewportSize viewportSize) { this.viewportSize = Optional.ofNullable(viewportSize); return this; } @@ -383,114 +383,114 @@ public interface Browser extends AutoCloseable { */ public Optional viewportSize; - public NewPageOptions withAcceptDownloads(boolean acceptDownloads) { + public NewPageOptions setAcceptDownloads(boolean acceptDownloads) { this.acceptDownloads = acceptDownloads; return this; } - public NewPageOptions withBypassCSP(boolean bypassCSP) { + public NewPageOptions setBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; return this; } - public NewPageOptions withColorScheme(ColorScheme colorScheme) { + public NewPageOptions setColorScheme(ColorScheme colorScheme) { this.colorScheme = colorScheme; return this; } - public NewPageOptions withDeviceScaleFactor(double deviceScaleFactor) { + public NewPageOptions setDeviceScaleFactor(double deviceScaleFactor) { this.deviceScaleFactor = deviceScaleFactor; return this; } - public NewPageOptions withExtraHTTPHeaders(Map extraHTTPHeaders) { + public NewPageOptions setExtraHTTPHeaders(Map extraHTTPHeaders) { this.extraHTTPHeaders = extraHTTPHeaders; return this; } - public NewPageOptions withGeolocation(double latitude, double longitude) { - return withGeolocation(new Geolocation(latitude, longitude)); + public NewPageOptions setGeolocation(double latitude, double longitude) { + return setGeolocation(new Geolocation(latitude, longitude)); } - public NewPageOptions withGeolocation(Geolocation geolocation) { + public NewPageOptions setGeolocation(Geolocation geolocation) { this.geolocation = geolocation; return this; } - public NewPageOptions withHasTouch(boolean hasTouch) { + public NewPageOptions setHasTouch(boolean hasTouch) { this.hasTouch = hasTouch; return this; } - public NewPageOptions withHttpCredentials(String username, String password) { - return withHttpCredentials(new HttpCredentials(username, password)); + public NewPageOptions setHttpCredentials(String username, String password) { + return setHttpCredentials(new HttpCredentials(username, password)); } - public NewPageOptions withHttpCredentials(HttpCredentials httpCredentials) { + public NewPageOptions setHttpCredentials(HttpCredentials httpCredentials) { this.httpCredentials = httpCredentials; return this; } - public NewPageOptions withIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { + public NewPageOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { this.ignoreHTTPSErrors = ignoreHTTPSErrors; return this; } - public NewPageOptions withIsMobile(boolean isMobile) { + public NewPageOptions setIsMobile(boolean isMobile) { this.isMobile = isMobile; return this; } - public NewPageOptions withJavaScriptEnabled(boolean javaScriptEnabled) { + public NewPageOptions setJavaScriptEnabled(boolean javaScriptEnabled) { this.javaScriptEnabled = javaScriptEnabled; return this; } - public NewPageOptions withLocale(String locale) { + public NewPageOptions setLocale(String locale) { this.locale = locale; return this; } - public NewPageOptions withOffline(boolean offline) { + public NewPageOptions setOffline(boolean offline) { this.offline = offline; return this; } - public NewPageOptions withPermissions(List permissions) { + public NewPageOptions setPermissions(List permissions) { this.permissions = permissions; return this; } - public NewPageOptions withProxy(String server) { - return withProxy(new Proxy(server)); + public NewPageOptions setProxy(String server) { + return setProxy(new Proxy(server)); } - public NewPageOptions withProxy(Proxy proxy) { + public NewPageOptions setProxy(Proxy proxy) { this.proxy = proxy; return this; } - public NewPageOptions withRecordHarOmitContent(boolean recordHarOmitContent) { + public NewPageOptions setRecordHarOmitContent(boolean recordHarOmitContent) { this.recordHarOmitContent = recordHarOmitContent; return this; } - public NewPageOptions withRecordHarPath(Path recordHarPath) { + public NewPageOptions setRecordHarPath(Path recordHarPath) { this.recordHarPath = recordHarPath; return this; } - public NewPageOptions withRecordVideoDir(Path recordVideoDir) { + public NewPageOptions setRecordVideoDir(Path recordVideoDir) { this.recordVideoDir = recordVideoDir; return this; } - public NewPageOptions withRecordVideoSize(int width, int height) { - return withRecordVideoSize(new RecordVideoSize(width, height)); + public NewPageOptions setRecordVideoSize(int width, int height) { + return setRecordVideoSize(new RecordVideoSize(width, height)); } - public NewPageOptions withRecordVideoSize(RecordVideoSize recordVideoSize) { + public NewPageOptions setRecordVideoSize(RecordVideoSize recordVideoSize) { this.recordVideoSize = recordVideoSize; return this; } - public NewPageOptions withStorageState(String storageState) { + public NewPageOptions setStorageState(String storageState) { this.storageState = storageState; return this; } - public NewPageOptions withStorageStatePath(Path storageStatePath) { + public NewPageOptions setStorageStatePath(Path storageStatePath) { this.storageStatePath = storageStatePath; return this; } - public NewPageOptions withTimezoneId(String timezoneId) { + public NewPageOptions setTimezoneId(String timezoneId) { this.timezoneId = timezoneId; return this; } - public NewPageOptions withUserAgent(String userAgent) { + public NewPageOptions setUserAgent(String userAgent) { this.userAgent = userAgent; return this; } - public NewPageOptions withViewportSize(int width, int height) { - return withViewportSize(new ViewportSize(width, height)); + public NewPageOptions setViewportSize(int width, int height) { + return setViewportSize(new ViewportSize(width, height)); } - public NewPageOptions withViewportSize(ViewportSize viewportSize) { + public NewPageOptions setViewportSize(ViewportSize viewportSize) { this.viewportSize = Optional.ofNullable(viewportSize); return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java index 109231ad..f0dbb737 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserContext.java @@ -88,7 +88,7 @@ public interface BrowserContext extends AutoCloseable { */ public Boolean handle; - public ExposeBindingOptions withHandle(boolean handle) { + public ExposeBindingOptions setHandle(boolean handle) { this.handle = handle; return this; } @@ -99,7 +99,7 @@ public interface BrowserContext extends AutoCloseable { */ public String origin; - public GrantPermissionsOptions withOrigin(String origin) { + public GrantPermissionsOptions setOrigin(String origin) { this.origin = origin; return this; } @@ -111,7 +111,7 @@ public interface BrowserContext extends AutoCloseable { */ public Path path; - public StorageStateOptions withPath(Path path) { + public StorageStateOptions setPath(Path path) { this.path = path; return this; } @@ -127,11 +127,11 @@ public interface BrowserContext extends AutoCloseable { */ public Double timeout; - public WaitForPageOptions withPredicate(Predicate predicate) { + public WaitForPageOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForPageOptions withTimeout(double timeout) { + public WaitForPageOptions setTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java index f9f6af9d..91f12602 100644 --- a/playwright/src/main/java/com/microsoft/playwright/BrowserType.java +++ b/playwright/src/main/java/com/microsoft/playwright/BrowserType.java @@ -53,11 +53,11 @@ public interface BrowserType { */ public Double timeout; - public ConnectOptions withSlowMo(double slowMo) { + public ConnectOptions setSlowMo(double slowMo) { this.slowMo = slowMo; return this; } - public ConnectOptions withTimeout(double timeout) { + public ConnectOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -140,70 +140,70 @@ public interface BrowserType { */ public Double timeout; - public LaunchOptions withArgs(List args) { + public LaunchOptions setArgs(List args) { this.args = args; return this; } - public LaunchOptions withChromiumSandbox(boolean chromiumSandbox) { + public LaunchOptions setChromiumSandbox(boolean chromiumSandbox) { this.chromiumSandbox = chromiumSandbox; return this; } - public LaunchOptions withDevtools(boolean devtools) { + public LaunchOptions setDevtools(boolean devtools) { this.devtools = devtools; return this; } - public LaunchOptions withDownloadsPath(Path downloadsPath) { + public LaunchOptions setDownloadsPath(Path downloadsPath) { this.downloadsPath = downloadsPath; return this; } - public LaunchOptions withEnv(Map env) { + public LaunchOptions setEnv(Map env) { this.env = env; return this; } - public LaunchOptions withExecutablePath(Path executablePath) { + public LaunchOptions setExecutablePath(Path executablePath) { this.executablePath = executablePath; return this; } - public LaunchOptions withFirefoxUserPrefs(Map firefoxUserPrefs) { + public LaunchOptions setFirefoxUserPrefs(Map firefoxUserPrefs) { this.firefoxUserPrefs = firefoxUserPrefs; return this; } - public LaunchOptions withHandleSIGHUP(boolean handleSIGHUP) { + public LaunchOptions setHandleSIGHUP(boolean handleSIGHUP) { this.handleSIGHUP = handleSIGHUP; return this; } - public LaunchOptions withHandleSIGINT(boolean handleSIGINT) { + public LaunchOptions setHandleSIGINT(boolean handleSIGINT) { this.handleSIGINT = handleSIGINT; return this; } - public LaunchOptions withHandleSIGTERM(boolean handleSIGTERM) { + public LaunchOptions setHandleSIGTERM(boolean handleSIGTERM) { this.handleSIGTERM = handleSIGTERM; return this; } - public LaunchOptions withHeadless(boolean headless) { + public LaunchOptions setHeadless(boolean headless) { this.headless = headless; return this; } - public LaunchOptions withIgnoreAllDefaultArgs(boolean ignoreAllDefaultArgs) { + public LaunchOptions setIgnoreAllDefaultArgs(boolean ignoreAllDefaultArgs) { this.ignoreAllDefaultArgs = ignoreAllDefaultArgs; return this; } - public LaunchOptions withIgnoreDefaultArgs(List ignoreDefaultArgs) { + public LaunchOptions setIgnoreDefaultArgs(List ignoreDefaultArgs) { this.ignoreDefaultArgs = ignoreDefaultArgs; return this; } - public LaunchOptions withProxy(String server) { - return withProxy(new Proxy(server)); + public LaunchOptions setProxy(String server) { + return setProxy(new Proxy(server)); } - public LaunchOptions withProxy(Proxy proxy) { + public LaunchOptions setProxy(Proxy proxy) { this.proxy = proxy; return this; } - public LaunchOptions withSlowMo(double slowMo) { + public LaunchOptions setSlowMo(double slowMo) { this.slowMo = slowMo; return this; } - public LaunchOptions withTimeout(double timeout) { + public LaunchOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -371,162 +371,162 @@ public interface BrowserType { */ public Optional viewportSize; - public LaunchPersistentContextOptions withAcceptDownloads(boolean acceptDownloads) { + public LaunchPersistentContextOptions setAcceptDownloads(boolean acceptDownloads) { this.acceptDownloads = acceptDownloads; return this; } - public LaunchPersistentContextOptions withArgs(List args) { + public LaunchPersistentContextOptions setArgs(List args) { this.args = args; return this; } - public LaunchPersistentContextOptions withBypassCSP(boolean bypassCSP) { + public LaunchPersistentContextOptions setBypassCSP(boolean bypassCSP) { this.bypassCSP = bypassCSP; return this; } - public LaunchPersistentContextOptions withChromiumSandbox(boolean chromiumSandbox) { + public LaunchPersistentContextOptions setChromiumSandbox(boolean chromiumSandbox) { this.chromiumSandbox = chromiumSandbox; return this; } - public LaunchPersistentContextOptions withColorScheme(ColorScheme colorScheme) { + public LaunchPersistentContextOptions setColorScheme(ColorScheme colorScheme) { this.colorScheme = colorScheme; return this; } - public LaunchPersistentContextOptions withDeviceScaleFactor(double deviceScaleFactor) { + public LaunchPersistentContextOptions setDeviceScaleFactor(double deviceScaleFactor) { this.deviceScaleFactor = deviceScaleFactor; return this; } - public LaunchPersistentContextOptions withDevtools(boolean devtools) { + public LaunchPersistentContextOptions setDevtools(boolean devtools) { this.devtools = devtools; return this; } - public LaunchPersistentContextOptions withDownloadsPath(Path downloadsPath) { + public LaunchPersistentContextOptions setDownloadsPath(Path downloadsPath) { this.downloadsPath = downloadsPath; return this; } - public LaunchPersistentContextOptions withEnv(Map env) { + public LaunchPersistentContextOptions setEnv(Map env) { this.env = env; return this; } - public LaunchPersistentContextOptions withExecutablePath(Path executablePath) { + public LaunchPersistentContextOptions setExecutablePath(Path executablePath) { this.executablePath = executablePath; return this; } - public LaunchPersistentContextOptions withExtraHTTPHeaders(Map extraHTTPHeaders) { + public LaunchPersistentContextOptions setExtraHTTPHeaders(Map extraHTTPHeaders) { this.extraHTTPHeaders = extraHTTPHeaders; return this; } - public LaunchPersistentContextOptions withGeolocation(double latitude, double longitude) { - return withGeolocation(new Geolocation(latitude, longitude)); + public LaunchPersistentContextOptions setGeolocation(double latitude, double longitude) { + return setGeolocation(new Geolocation(latitude, longitude)); } - public LaunchPersistentContextOptions withGeolocation(Geolocation geolocation) { + public LaunchPersistentContextOptions setGeolocation(Geolocation geolocation) { this.geolocation = geolocation; return this; } - public LaunchPersistentContextOptions withHandleSIGHUP(boolean handleSIGHUP) { + public LaunchPersistentContextOptions setHandleSIGHUP(boolean handleSIGHUP) { this.handleSIGHUP = handleSIGHUP; return this; } - public LaunchPersistentContextOptions withHandleSIGINT(boolean handleSIGINT) { + public LaunchPersistentContextOptions setHandleSIGINT(boolean handleSIGINT) { this.handleSIGINT = handleSIGINT; return this; } - public LaunchPersistentContextOptions withHandleSIGTERM(boolean handleSIGTERM) { + public LaunchPersistentContextOptions setHandleSIGTERM(boolean handleSIGTERM) { this.handleSIGTERM = handleSIGTERM; return this; } - public LaunchPersistentContextOptions withHasTouch(boolean hasTouch) { + public LaunchPersistentContextOptions setHasTouch(boolean hasTouch) { this.hasTouch = hasTouch; return this; } - public LaunchPersistentContextOptions withHeadless(boolean headless) { + public LaunchPersistentContextOptions setHeadless(boolean headless) { this.headless = headless; return this; } - public LaunchPersistentContextOptions withHttpCredentials(String username, String password) { - return withHttpCredentials(new HttpCredentials(username, password)); + public LaunchPersistentContextOptions setHttpCredentials(String username, String password) { + return setHttpCredentials(new HttpCredentials(username, password)); } - public LaunchPersistentContextOptions withHttpCredentials(HttpCredentials httpCredentials) { + public LaunchPersistentContextOptions setHttpCredentials(HttpCredentials httpCredentials) { this.httpCredentials = httpCredentials; return this; } - public LaunchPersistentContextOptions withIgnoreAllDefaultArgs(boolean ignoreAllDefaultArgs) { + public LaunchPersistentContextOptions setIgnoreAllDefaultArgs(boolean ignoreAllDefaultArgs) { this.ignoreAllDefaultArgs = ignoreAllDefaultArgs; return this; } - public LaunchPersistentContextOptions withIgnoreDefaultArgs(List ignoreDefaultArgs) { + public LaunchPersistentContextOptions setIgnoreDefaultArgs(List ignoreDefaultArgs) { this.ignoreDefaultArgs = ignoreDefaultArgs; return this; } - public LaunchPersistentContextOptions withIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { + public LaunchPersistentContextOptions setIgnoreHTTPSErrors(boolean ignoreHTTPSErrors) { this.ignoreHTTPSErrors = ignoreHTTPSErrors; return this; } - public LaunchPersistentContextOptions withIsMobile(boolean isMobile) { + public LaunchPersistentContextOptions setIsMobile(boolean isMobile) { this.isMobile = isMobile; return this; } - public LaunchPersistentContextOptions withJavaScriptEnabled(boolean javaScriptEnabled) { + public LaunchPersistentContextOptions setJavaScriptEnabled(boolean javaScriptEnabled) { this.javaScriptEnabled = javaScriptEnabled; return this; } - public LaunchPersistentContextOptions withLocale(String locale) { + public LaunchPersistentContextOptions setLocale(String locale) { this.locale = locale; return this; } - public LaunchPersistentContextOptions withOffline(boolean offline) { + public LaunchPersistentContextOptions setOffline(boolean offline) { this.offline = offline; return this; } - public LaunchPersistentContextOptions withPermissions(List permissions) { + public LaunchPersistentContextOptions setPermissions(List permissions) { this.permissions = permissions; return this; } - public LaunchPersistentContextOptions withProxy(String server) { - return withProxy(new Proxy(server)); + public LaunchPersistentContextOptions setProxy(String server) { + return setProxy(new Proxy(server)); } - public LaunchPersistentContextOptions withProxy(Proxy proxy) { + public LaunchPersistentContextOptions setProxy(Proxy proxy) { this.proxy = proxy; return this; } - public LaunchPersistentContextOptions withRecordHarOmitContent(boolean recordHarOmitContent) { + public LaunchPersistentContextOptions setRecordHarOmitContent(boolean recordHarOmitContent) { this.recordHarOmitContent = recordHarOmitContent; return this; } - public LaunchPersistentContextOptions withRecordHarPath(Path recordHarPath) { + public LaunchPersistentContextOptions setRecordHarPath(Path recordHarPath) { this.recordHarPath = recordHarPath; return this; } - public LaunchPersistentContextOptions withRecordVideoDir(Path recordVideoDir) { + public LaunchPersistentContextOptions setRecordVideoDir(Path recordVideoDir) { this.recordVideoDir = recordVideoDir; return this; } - public LaunchPersistentContextOptions withRecordVideoSize(int width, int height) { - return withRecordVideoSize(new RecordVideoSize(width, height)); + public LaunchPersistentContextOptions setRecordVideoSize(int width, int height) { + return setRecordVideoSize(new RecordVideoSize(width, height)); } - public LaunchPersistentContextOptions withRecordVideoSize(RecordVideoSize recordVideoSize) { + public LaunchPersistentContextOptions setRecordVideoSize(RecordVideoSize recordVideoSize) { this.recordVideoSize = recordVideoSize; return this; } - public LaunchPersistentContextOptions withSlowMo(double slowMo) { + public LaunchPersistentContextOptions setSlowMo(double slowMo) { this.slowMo = slowMo; return this; } - public LaunchPersistentContextOptions withTimeout(double timeout) { + public LaunchPersistentContextOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public LaunchPersistentContextOptions withTimezoneId(String timezoneId) { + public LaunchPersistentContextOptions setTimezoneId(String timezoneId) { this.timezoneId = timezoneId; return this; } - public LaunchPersistentContextOptions withUserAgent(String userAgent) { + public LaunchPersistentContextOptions setUserAgent(String userAgent) { this.userAgent = userAgent; return this; } - public LaunchPersistentContextOptions withViewportSize(int width, int height) { - return withViewportSize(new ViewportSize(width, height)); + public LaunchPersistentContextOptions setViewportSize(int width, int height) { + return setViewportSize(new ViewportSize(width, height)); } - public LaunchPersistentContextOptions withViewportSize(ViewportSize viewportSize) { + public LaunchPersistentContextOptions setViewportSize(ViewportSize viewportSize) { this.viewportSize = Optional.ofNullable(viewportSize); return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java index 30773e6b..f9beb55b 100644 --- a/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java +++ b/playwright/src/main/java/com/microsoft/playwright/ElementHandle.java @@ -67,15 +67,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public CheckOptions withForce(boolean force) { + public CheckOptions setForce(boolean force) { this.force = force; return this; } - public CheckOptions withNoWaitAfter(boolean noWaitAfter) { + public CheckOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public CheckOptions withTimeout(double timeout) { + public CheckOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -121,38 +121,38 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public ClickOptions withButton(MouseButton button) { + public ClickOptions setButton(MouseButton button) { this.button = button; return this; } - public ClickOptions withClickCount(int clickCount) { + public ClickOptions setClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(double delay) { + public ClickOptions setDelay(double delay) { this.delay = delay; return this; } - public ClickOptions withForce(boolean force) { + public ClickOptions setForce(boolean force) { this.force = force; return this; } - public ClickOptions withModifiers(List modifiers) { + public ClickOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public ClickOptions withNoWaitAfter(boolean noWaitAfter) { + public ClickOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public ClickOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public ClickOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public ClickOptions withPosition(Position position) { + public ClickOptions setPosition(Position position) { this.position = position; return this; } - public ClickOptions withTimeout(double timeout) { + public ClickOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -194,34 +194,34 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public DblclickOptions withButton(MouseButton button) { + public DblclickOptions setButton(MouseButton button) { this.button = button; return this; } - public DblclickOptions withDelay(double delay) { + public DblclickOptions setDelay(double delay) { this.delay = delay; return this; } - public DblclickOptions withForce(boolean force) { + public DblclickOptions setForce(boolean force) { this.force = force; return this; } - public DblclickOptions withModifiers(List modifiers) { + public DblclickOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public DblclickOptions withNoWaitAfter(boolean noWaitAfter) { + public DblclickOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public DblclickOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public DblclickOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public DblclickOptions withPosition(Position position) { + public DblclickOptions setPosition(Position position) { this.position = position; return this; } - public DblclickOptions withTimeout(double timeout) { + public DblclickOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -240,11 +240,11 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public FillOptions withNoWaitAfter(boolean noWaitAfter) { + public FillOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public FillOptions withTimeout(double timeout) { + public FillOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -272,22 +272,22 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public HoverOptions withForce(boolean force) { + public HoverOptions setForce(boolean force) { this.force = force; return this; } - public HoverOptions withModifiers(List modifiers) { + public HoverOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public HoverOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public HoverOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public HoverOptions withPosition(Position position) { + public HoverOptions setPosition(Position position) { this.position = position; return this; } - public HoverOptions withTimeout(double timeout) { + public HoverOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -310,15 +310,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public PressOptions withDelay(double delay) { + public PressOptions setDelay(double delay) { this.delay = delay; return this; } - public PressOptions withNoWaitAfter(boolean noWaitAfter) { + public PressOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public PressOptions withTimeout(double timeout) { + public PressOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -350,23 +350,23 @@ public interface ElementHandle extends JSHandle { */ public ScreenshotType type; - public ScreenshotOptions withOmitBackground(boolean omitBackground) { + public ScreenshotOptions setOmitBackground(boolean omitBackground) { this.omitBackground = omitBackground; return this; } - public ScreenshotOptions withPath(Path path) { + public ScreenshotOptions setPath(Path path) { this.path = path; return this; } - public ScreenshotOptions withQuality(int quality) { + public ScreenshotOptions setQuality(int quality) { this.quality = quality; return this; } - public ScreenshotOptions withTimeout(double timeout) { + public ScreenshotOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public ScreenshotOptions withType(ScreenshotType type) { + public ScreenshotOptions setType(ScreenshotType type) { this.type = type; return this; } @@ -379,7 +379,7 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public ScrollIntoViewIfNeededOptions withTimeout(double timeout) { + public ScrollIntoViewIfNeededOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -398,11 +398,11 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public SelectOptionOptions withNoWaitAfter(boolean noWaitAfter) { + public SelectOptionOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SelectOptionOptions withTimeout(double timeout) { + public SelectOptionOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -415,7 +415,7 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public SelectTextOptions withTimeout(double timeout) { + public SelectTextOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -434,11 +434,11 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public SetInputFilesOptions withNoWaitAfter(boolean noWaitAfter) { + public SetInputFilesOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetInputFilesOptions withTimeout(double timeout) { + public SetInputFilesOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -472,26 +472,26 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public TapOptions withForce(boolean force) { + public TapOptions setForce(boolean force) { this.force = force; return this; } - public TapOptions withModifiers(List modifiers) { + public TapOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public TapOptions withNoWaitAfter(boolean noWaitAfter) { + public TapOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TapOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public TapOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public TapOptions withPosition(Position position) { + public TapOptions setPosition(Position position) { this.position = position; return this; } - public TapOptions withTimeout(double timeout) { + public TapOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -514,15 +514,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public TypeOptions withDelay(double delay) { + public TypeOptions setDelay(double delay) { this.delay = delay; return this; } - public TypeOptions withNoWaitAfter(boolean noWaitAfter) { + public TypeOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TypeOptions withTimeout(double timeout) { + public TypeOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -546,15 +546,15 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public UncheckOptions withForce(boolean force) { + public UncheckOptions setForce(boolean force) { this.force = force; return this; } - public UncheckOptions withNoWaitAfter(boolean noWaitAfter) { + public UncheckOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public UncheckOptions withTimeout(double timeout) { + public UncheckOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -567,7 +567,7 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public WaitForElementStateOptions withTimeout(double timeout) { + public WaitForElementStateOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -592,11 +592,11 @@ public interface ElementHandle extends JSHandle { */ public Double timeout; - public WaitForSelectorOptions withState(WaitForSelectorState state) { + public WaitForSelectorOptions setState(WaitForSelectorState state) { this.state = state; return this; } - public WaitForSelectorOptions withTimeout(double timeout) { + public WaitForSelectorOptions setTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/FileChooser.java b/playwright/src/main/java/com/microsoft/playwright/FileChooser.java index 0711a228..d5c5cf46 100644 --- a/playwright/src/main/java/com/microsoft/playwright/FileChooser.java +++ b/playwright/src/main/java/com/microsoft/playwright/FileChooser.java @@ -42,11 +42,11 @@ public interface FileChooser { */ public Double timeout; - public SetFilesOptions withNoWaitAfter(boolean noWaitAfter) { + public SetFilesOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetFilesOptions withTimeout(double timeout) { + public SetFilesOptions setTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Frame.java b/playwright/src/main/java/com/microsoft/playwright/Frame.java index 78f5283d..32973612 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Frame.java +++ b/playwright/src/main/java/com/microsoft/playwright/Frame.java @@ -80,19 +80,19 @@ public interface Frame { */ public String url; - public AddScriptTagOptions withContent(String content) { + public AddScriptTagOptions setContent(String content) { this.content = content; return this; } - public AddScriptTagOptions withPath(Path path) { + public AddScriptTagOptions setPath(Path path) { this.path = path; return this; } - public AddScriptTagOptions withType(String type) { + public AddScriptTagOptions setType(String type) { this.type = type; return this; } - public AddScriptTagOptions withUrl(String url) { + public AddScriptTagOptions setUrl(String url) { this.url = url; return this; } @@ -112,15 +112,15 @@ public interface Frame { */ public String url; - public AddStyleTagOptions withContent(String content) { + public AddStyleTagOptions setContent(String content) { this.content = content; return this; } - public AddStyleTagOptions withPath(Path path) { + public AddStyleTagOptions setPath(Path path) { this.path = path; return this; } - public AddStyleTagOptions withUrl(String url) { + public AddStyleTagOptions setUrl(String url) { this.url = url; return this; } @@ -144,15 +144,15 @@ public interface Frame { */ public Double timeout; - public CheckOptions withForce(boolean force) { + public CheckOptions setForce(boolean force) { this.force = force; return this; } - public CheckOptions withNoWaitAfter(boolean noWaitAfter) { + public CheckOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public CheckOptions withTimeout(double timeout) { + public CheckOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -198,38 +198,38 @@ public interface Frame { */ public Double timeout; - public ClickOptions withButton(MouseButton button) { + public ClickOptions setButton(MouseButton button) { this.button = button; return this; } - public ClickOptions withClickCount(int clickCount) { + public ClickOptions setClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(double delay) { + public ClickOptions setDelay(double delay) { this.delay = delay; return this; } - public ClickOptions withForce(boolean force) { + public ClickOptions setForce(boolean force) { this.force = force; return this; } - public ClickOptions withModifiers(List modifiers) { + public ClickOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public ClickOptions withNoWaitAfter(boolean noWaitAfter) { + public ClickOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public ClickOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public ClickOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public ClickOptions withPosition(Position position) { + public ClickOptions setPosition(Position position) { this.position = position; return this; } - public ClickOptions withTimeout(double timeout) { + public ClickOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -271,34 +271,34 @@ public interface Frame { */ public Double timeout; - public DblclickOptions withButton(MouseButton button) { + public DblclickOptions setButton(MouseButton button) { this.button = button; return this; } - public DblclickOptions withDelay(double delay) { + public DblclickOptions setDelay(double delay) { this.delay = delay; return this; } - public DblclickOptions withForce(boolean force) { + public DblclickOptions setForce(boolean force) { this.force = force; return this; } - public DblclickOptions withModifiers(List modifiers) { + public DblclickOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public DblclickOptions withNoWaitAfter(boolean noWaitAfter) { + public DblclickOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public DblclickOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public DblclickOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public DblclickOptions withPosition(Position position) { + public DblclickOptions setPosition(Position position) { this.position = position; return this; } - public DblclickOptions withTimeout(double timeout) { + public DblclickOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -311,7 +311,7 @@ public interface Frame { */ public Double timeout; - public DispatchEventOptions withTimeout(double timeout) { + public DispatchEventOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -330,11 +330,11 @@ public interface Frame { */ public Double timeout; - public FillOptions withNoWaitAfter(boolean noWaitAfter) { + public FillOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public FillOptions withTimeout(double timeout) { + public FillOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -347,7 +347,7 @@ public interface Frame { */ public Double timeout; - public FocusOptions withTimeout(double timeout) { + public FocusOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -360,7 +360,7 @@ public interface Frame { */ public Double timeout; - public GetAttributeOptions withTimeout(double timeout) { + public GetAttributeOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -388,15 +388,15 @@ public interface Frame { */ public WaitUntilState waitUntil; - public NavigateOptions withReferer(String referer) { + public NavigateOptions setReferer(String referer) { this.referer = referer; return this; } - public NavigateOptions withTimeout(double timeout) { + public NavigateOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public NavigateOptions withWaitUntil(WaitUntilState waitUntil) { + public NavigateOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -424,22 +424,22 @@ public interface Frame { */ public Double timeout; - public HoverOptions withForce(boolean force) { + public HoverOptions setForce(boolean force) { this.force = force; return this; } - public HoverOptions withModifiers(List modifiers) { + public HoverOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public HoverOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public HoverOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public HoverOptions withPosition(Position position) { + public HoverOptions setPosition(Position position) { this.position = position; return this; } - public HoverOptions withTimeout(double timeout) { + public HoverOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -452,7 +452,7 @@ public interface Frame { */ public Double timeout; - public InnerHTMLOptions withTimeout(double timeout) { + public InnerHTMLOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -465,7 +465,7 @@ public interface Frame { */ public Double timeout; - public InnerTextOptions withTimeout(double timeout) { + public InnerTextOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -478,7 +478,7 @@ public interface Frame { */ public Double timeout; - public IsCheckedOptions withTimeout(double timeout) { + public IsCheckedOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -491,7 +491,7 @@ public interface Frame { */ public Double timeout; - public IsDisabledOptions withTimeout(double timeout) { + public IsDisabledOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -504,7 +504,7 @@ public interface Frame { */ public Double timeout; - public IsEditableOptions withTimeout(double timeout) { + public IsEditableOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -517,7 +517,7 @@ public interface Frame { */ public Double timeout; - public IsEnabledOptions withTimeout(double timeout) { + public IsEnabledOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -530,7 +530,7 @@ public interface Frame { */ public Double timeout; - public IsHiddenOptions withTimeout(double timeout) { + public IsHiddenOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -543,7 +543,7 @@ public interface Frame { */ public Double timeout; - public IsVisibleOptions withTimeout(double timeout) { + public IsVisibleOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -566,15 +566,15 @@ public interface Frame { */ public Double timeout; - public PressOptions withDelay(double delay) { + public PressOptions setDelay(double delay) { this.delay = delay; return this; } - public PressOptions withNoWaitAfter(boolean noWaitAfter) { + public PressOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public PressOptions withTimeout(double timeout) { + public PressOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -593,11 +593,11 @@ public interface Frame { */ public Double timeout; - public SelectOptionOptions withNoWaitAfter(boolean noWaitAfter) { + public SelectOptionOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SelectOptionOptions withTimeout(double timeout) { + public SelectOptionOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -620,11 +620,11 @@ public interface Frame { */ public WaitUntilState waitUntil; - public SetContentOptions withTimeout(double timeout) { + public SetContentOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public SetContentOptions withWaitUntil(WaitUntilState waitUntil) { + public SetContentOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -643,11 +643,11 @@ public interface Frame { */ public Double timeout; - public SetInputFilesOptions withNoWaitAfter(boolean noWaitAfter) { + public SetInputFilesOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetInputFilesOptions withTimeout(double timeout) { + public SetInputFilesOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -681,26 +681,26 @@ public interface Frame { */ public Double timeout; - public TapOptions withForce(boolean force) { + public TapOptions setForce(boolean force) { this.force = force; return this; } - public TapOptions withModifiers(List modifiers) { + public TapOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public TapOptions withNoWaitAfter(boolean noWaitAfter) { + public TapOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TapOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public TapOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public TapOptions withPosition(Position position) { + public TapOptions setPosition(Position position) { this.position = position; return this; } - public TapOptions withTimeout(double timeout) { + public TapOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -713,7 +713,7 @@ public interface Frame { */ public Double timeout; - public TextContentOptions withTimeout(double timeout) { + public TextContentOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -736,15 +736,15 @@ public interface Frame { */ public Double timeout; - public TypeOptions withDelay(double delay) { + public TypeOptions setDelay(double delay) { this.delay = delay; return this; } - public TypeOptions withNoWaitAfter(boolean noWaitAfter) { + public TypeOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TypeOptions withTimeout(double timeout) { + public TypeOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -768,15 +768,15 @@ public interface Frame { */ public Double timeout; - public UncheckOptions withForce(boolean force) { + public UncheckOptions setForce(boolean force) { this.force = force; return this; } - public UncheckOptions withNoWaitAfter(boolean noWaitAfter) { + public UncheckOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public UncheckOptions withTimeout(double timeout) { + public UncheckOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -793,11 +793,11 @@ public interface Frame { */ public Double timeout; - public WaitForFunctionOptions withPollingInterval(double pollingInterval) { + public WaitForFunctionOptions setPollingInterval(double pollingInterval) { this.pollingInterval = pollingInterval; return this; } - public WaitForFunctionOptions withTimeout(double timeout) { + public WaitForFunctionOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -811,7 +811,7 @@ public interface Frame { */ public Double timeout; - public WaitForLoadStateOptions withTimeout(double timeout) { + public WaitForLoadStateOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -838,23 +838,23 @@ public interface Frame { */ public WaitUntilState waitUntil; - public WaitForNavigationOptions withTimeout(double timeout) { + public WaitForNavigationOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public WaitForNavigationOptions withUrl(String url) { + public WaitForNavigationOptions setUrl(String url) { this.url = url; return this; } - public WaitForNavigationOptions withUrl(Pattern url) { + public WaitForNavigationOptions setUrl(Pattern url) { this.url = url; return this; } - public WaitForNavigationOptions withUrl(Predicate url) { + public WaitForNavigationOptions setUrl(Predicate url) { this.url = url; return this; } - public WaitForNavigationOptions withWaitUntil(WaitUntilState waitUntil) { + public WaitForNavigationOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -879,11 +879,11 @@ public interface Frame { */ public Double timeout; - public WaitForSelectorOptions withState(WaitForSelectorState state) { + public WaitForSelectorOptions setState(WaitForSelectorState state) { this.state = state; return this; } - public WaitForSelectorOptions withTimeout(double timeout) { + public WaitForSelectorOptions setTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Keyboard.java b/playwright/src/main/java/com/microsoft/playwright/Keyboard.java index ebdd838a..0717039c 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Keyboard.java +++ b/playwright/src/main/java/com/microsoft/playwright/Keyboard.java @@ -60,7 +60,7 @@ public interface Keyboard { */ public Double delay; - public PressOptions withDelay(double delay) { + public PressOptions setDelay(double delay) { this.delay = delay; return this; } @@ -71,7 +71,7 @@ public interface Keyboard { */ public Double delay; - public TypeOptions withDelay(double delay) { + public TypeOptions setDelay(double delay) { this.delay = delay; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Mouse.java b/playwright/src/main/java/com/microsoft/playwright/Mouse.java index 585f411b..9e7774dd 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Mouse.java +++ b/playwright/src/main/java/com/microsoft/playwright/Mouse.java @@ -49,15 +49,15 @@ public interface Mouse { */ public Double delay; - public ClickOptions withButton(MouseButton button) { + public ClickOptions setButton(MouseButton button) { this.button = button; return this; } - public ClickOptions withClickCount(int clickCount) { + public ClickOptions setClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(double delay) { + public ClickOptions setDelay(double delay) { this.delay = delay; return this; } @@ -72,11 +72,11 @@ public interface Mouse { */ public Double delay; - public DblclickOptions withButton(MouseButton button) { + public DblclickOptions setButton(MouseButton button) { this.button = button; return this; } - public DblclickOptions withDelay(double delay) { + public DblclickOptions setDelay(double delay) { this.delay = delay; return this; } @@ -91,11 +91,11 @@ public interface Mouse { */ public Integer clickCount; - public DownOptions withButton(MouseButton button) { + public DownOptions setButton(MouseButton button) { this.button = button; return this; } - public DownOptions withClickCount(int clickCount) { + public DownOptions setClickCount(int clickCount) { this.clickCount = clickCount; return this; } @@ -106,7 +106,7 @@ public interface Mouse { */ public Integer steps; - public MoveOptions withSteps(int steps) { + public MoveOptions setSteps(int steps) { this.steps = steps; return this; } @@ -121,11 +121,11 @@ public interface Mouse { */ public Integer clickCount; - public UpOptions withButton(MouseButton button) { + public UpOptions setButton(MouseButton button) { this.button = button; return this; } - public UpOptions withClickCount(int clickCount) { + public UpOptions setClickCount(int clickCount) { this.clickCount = clickCount; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Page.java b/playwright/src/main/java/com/microsoft/playwright/Page.java index 7746244a..8f043368 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Page.java +++ b/playwright/src/main/java/com/microsoft/playwright/Page.java @@ -325,19 +325,19 @@ public interface Page extends AutoCloseable { */ public String url; - public AddScriptTagOptions withContent(String content) { + public AddScriptTagOptions setContent(String content) { this.content = content; return this; } - public AddScriptTagOptions withPath(Path path) { + public AddScriptTagOptions setPath(Path path) { this.path = path; return this; } - public AddScriptTagOptions withType(String type) { + public AddScriptTagOptions setType(String type) { this.type = type; return this; } - public AddScriptTagOptions withUrl(String url) { + public AddScriptTagOptions setUrl(String url) { this.url = url; return this; } @@ -357,15 +357,15 @@ public interface Page extends AutoCloseable { */ public String url; - public AddStyleTagOptions withContent(String content) { + public AddStyleTagOptions setContent(String content) { this.content = content; return this; } - public AddStyleTagOptions withPath(Path path) { + public AddStyleTagOptions setPath(Path path) { this.path = path; return this; } - public AddStyleTagOptions withUrl(String url) { + public AddStyleTagOptions setUrl(String url) { this.url = url; return this; } @@ -389,15 +389,15 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public CheckOptions withForce(boolean force) { + public CheckOptions setForce(boolean force) { this.force = force; return this; } - public CheckOptions withNoWaitAfter(boolean noWaitAfter) { + public CheckOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public CheckOptions withTimeout(double timeout) { + public CheckOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -443,38 +443,38 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public ClickOptions withButton(MouseButton button) { + public ClickOptions setButton(MouseButton button) { this.button = button; return this; } - public ClickOptions withClickCount(int clickCount) { + public ClickOptions setClickCount(int clickCount) { this.clickCount = clickCount; return this; } - public ClickOptions withDelay(double delay) { + public ClickOptions setDelay(double delay) { this.delay = delay; return this; } - public ClickOptions withForce(boolean force) { + public ClickOptions setForce(boolean force) { this.force = force; return this; } - public ClickOptions withModifiers(List modifiers) { + public ClickOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public ClickOptions withNoWaitAfter(boolean noWaitAfter) { + public ClickOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public ClickOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public ClickOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public ClickOptions withPosition(Position position) { + public ClickOptions setPosition(Position position) { this.position = position; return this; } - public ClickOptions withTimeout(double timeout) { + public ClickOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -486,7 +486,7 @@ public interface Page extends AutoCloseable { */ public Boolean runBeforeUnload; - public CloseOptions withRunBeforeUnload(boolean runBeforeUnload) { + public CloseOptions setRunBeforeUnload(boolean runBeforeUnload) { this.runBeforeUnload = runBeforeUnload; return this; } @@ -528,34 +528,34 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public DblclickOptions withButton(MouseButton button) { + public DblclickOptions setButton(MouseButton button) { this.button = button; return this; } - public DblclickOptions withDelay(double delay) { + public DblclickOptions setDelay(double delay) { this.delay = delay; return this; } - public DblclickOptions withForce(boolean force) { + public DblclickOptions setForce(boolean force) { this.force = force; return this; } - public DblclickOptions withModifiers(List modifiers) { + public DblclickOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public DblclickOptions withNoWaitAfter(boolean noWaitAfter) { + public DblclickOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public DblclickOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public DblclickOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public DblclickOptions withPosition(Position position) { + public DblclickOptions setPosition(Position position) { this.position = position; return this; } - public DblclickOptions withTimeout(double timeout) { + public DblclickOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -568,7 +568,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public DispatchEventOptions withTimeout(double timeout) { + public DispatchEventOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -585,11 +585,11 @@ public interface Page extends AutoCloseable { */ public Optional media; - public EmulateMediaOptions withColorScheme(ColorScheme colorScheme) { + public EmulateMediaOptions setColorScheme(ColorScheme colorScheme) { this.colorScheme = Optional.ofNullable(colorScheme); return this; } - public EmulateMediaOptions withMedia(Media media) { + public EmulateMediaOptions setMedia(Media media) { this.media = Optional.ofNullable(media); return this; } @@ -601,7 +601,7 @@ public interface Page extends AutoCloseable { */ public Boolean handle; - public ExposeBindingOptions withHandle(boolean handle) { + public ExposeBindingOptions setHandle(boolean handle) { this.handle = handle; return this; } @@ -620,11 +620,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public FillOptions withNoWaitAfter(boolean noWaitAfter) { + public FillOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public FillOptions withTimeout(double timeout) { + public FillOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -637,7 +637,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public FocusOptions withTimeout(double timeout) { + public FocusOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -650,7 +650,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public GetAttributeOptions withTimeout(double timeout) { + public GetAttributeOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -673,11 +673,11 @@ public interface Page extends AutoCloseable { */ public WaitUntilState waitUntil; - public GoBackOptions withTimeout(double timeout) { + public GoBackOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public GoBackOptions withWaitUntil(WaitUntilState waitUntil) { + public GoBackOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -700,11 +700,11 @@ public interface Page extends AutoCloseable { */ public WaitUntilState waitUntil; - public GoForwardOptions withTimeout(double timeout) { + public GoForwardOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public GoForwardOptions withWaitUntil(WaitUntilState waitUntil) { + public GoForwardOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -732,15 +732,15 @@ public interface Page extends AutoCloseable { */ public WaitUntilState waitUntil; - public NavigateOptions withReferer(String referer) { + public NavigateOptions setReferer(String referer) { this.referer = referer; return this; } - public NavigateOptions withTimeout(double timeout) { + public NavigateOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public NavigateOptions withWaitUntil(WaitUntilState waitUntil) { + public NavigateOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -768,22 +768,22 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public HoverOptions withForce(boolean force) { + public HoverOptions setForce(boolean force) { this.force = force; return this; } - public HoverOptions withModifiers(List modifiers) { + public HoverOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public HoverOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public HoverOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public HoverOptions withPosition(Position position) { + public HoverOptions setPosition(Position position) { this.position = position; return this; } - public HoverOptions withTimeout(double timeout) { + public HoverOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -796,7 +796,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public InnerHTMLOptions withTimeout(double timeout) { + public InnerHTMLOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -809,7 +809,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public InnerTextOptions withTimeout(double timeout) { + public InnerTextOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -822,7 +822,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public IsCheckedOptions withTimeout(double timeout) { + public IsCheckedOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -835,7 +835,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public IsDisabledOptions withTimeout(double timeout) { + public IsDisabledOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -848,7 +848,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public IsEditableOptions withTimeout(double timeout) { + public IsEditableOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -861,7 +861,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public IsEnabledOptions withTimeout(double timeout) { + public IsEnabledOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -874,7 +874,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public IsHiddenOptions withTimeout(double timeout) { + public IsHiddenOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -887,7 +887,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public IsVisibleOptions withTimeout(double timeout) { + public IsVisibleOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -956,55 +956,55 @@ public interface Page extends AutoCloseable { */ public String width; - public PdfOptions withDisplayHeaderFooter(boolean displayHeaderFooter) { + public PdfOptions setDisplayHeaderFooter(boolean displayHeaderFooter) { this.displayHeaderFooter = displayHeaderFooter; return this; } - public PdfOptions withFooterTemplate(String footerTemplate) { + public PdfOptions setFooterTemplate(String footerTemplate) { this.footerTemplate = footerTemplate; return this; } - public PdfOptions withFormat(String format) { + public PdfOptions setFormat(String format) { this.format = format; return this; } - public PdfOptions withHeaderTemplate(String headerTemplate) { + public PdfOptions setHeaderTemplate(String headerTemplate) { this.headerTemplate = headerTemplate; return this; } - public PdfOptions withHeight(String height) { + public PdfOptions setHeight(String height) { this.height = height; return this; } - public PdfOptions withLandscape(boolean landscape) { + public PdfOptions setLandscape(boolean landscape) { this.landscape = landscape; return this; } - public PdfOptions withMargin(Margin margin) { + public PdfOptions setMargin(Margin margin) { this.margin = margin; return this; } - public PdfOptions withPageRanges(String pageRanges) { + public PdfOptions setPageRanges(String pageRanges) { this.pageRanges = pageRanges; return this; } - public PdfOptions withPath(Path path) { + public PdfOptions setPath(Path path) { this.path = path; return this; } - public PdfOptions withPreferCSSPageSize(boolean preferCSSPageSize) { + public PdfOptions setPreferCSSPageSize(boolean preferCSSPageSize) { this.preferCSSPageSize = preferCSSPageSize; return this; } - public PdfOptions withPrintBackground(boolean printBackground) { + public PdfOptions setPrintBackground(boolean printBackground) { this.printBackground = printBackground; return this; } - public PdfOptions withScale(double scale) { + public PdfOptions setScale(double scale) { this.scale = scale; return this; } - public PdfOptions withWidth(String width) { + public PdfOptions setWidth(String width) { this.width = width; return this; } @@ -1027,15 +1027,15 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public PressOptions withDelay(double delay) { + public PressOptions setDelay(double delay) { this.delay = delay; return this; } - public PressOptions withNoWaitAfter(boolean noWaitAfter) { + public PressOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public PressOptions withTimeout(double timeout) { + public PressOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1058,11 +1058,11 @@ public interface Page extends AutoCloseable { */ public WaitUntilState waitUntil; - public ReloadOptions withTimeout(double timeout) { + public ReloadOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public ReloadOptions withWaitUntil(WaitUntilState waitUntil) { + public ReloadOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -1103,34 +1103,34 @@ public interface Page extends AutoCloseable { */ public ScreenshotType type; - public ScreenshotOptions withClip(double x, double y, double width, double height) { - return withClip(new Clip(x, y, width, height)); + public ScreenshotOptions setClip(double x, double y, double width, double height) { + return setClip(new Clip(x, y, width, height)); } - public ScreenshotOptions withClip(Clip clip) { + public ScreenshotOptions setClip(Clip clip) { this.clip = clip; return this; } - public ScreenshotOptions withFullPage(boolean fullPage) { + public ScreenshotOptions setFullPage(boolean fullPage) { this.fullPage = fullPage; return this; } - public ScreenshotOptions withOmitBackground(boolean omitBackground) { + public ScreenshotOptions setOmitBackground(boolean omitBackground) { this.omitBackground = omitBackground; return this; } - public ScreenshotOptions withPath(Path path) { + public ScreenshotOptions setPath(Path path) { this.path = path; return this; } - public ScreenshotOptions withQuality(int quality) { + public ScreenshotOptions setQuality(int quality) { this.quality = quality; return this; } - public ScreenshotOptions withTimeout(double timeout) { + public ScreenshotOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public ScreenshotOptions withType(ScreenshotType type) { + public ScreenshotOptions setType(ScreenshotType type) { this.type = type; return this; } @@ -1149,11 +1149,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public SelectOptionOptions withNoWaitAfter(boolean noWaitAfter) { + public SelectOptionOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SelectOptionOptions withTimeout(double timeout) { + public SelectOptionOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1176,11 +1176,11 @@ public interface Page extends AutoCloseable { */ public WaitUntilState waitUntil; - public SetContentOptions withTimeout(double timeout) { + public SetContentOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public SetContentOptions withWaitUntil(WaitUntilState waitUntil) { + public SetContentOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -1199,11 +1199,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public SetInputFilesOptions withNoWaitAfter(boolean noWaitAfter) { + public SetInputFilesOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public SetInputFilesOptions withTimeout(double timeout) { + public SetInputFilesOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1237,26 +1237,26 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public TapOptions withForce(boolean force) { + public TapOptions setForce(boolean force) { this.force = force; return this; } - public TapOptions withModifiers(List modifiers) { + public TapOptions setModifiers(List modifiers) { this.modifiers = modifiers; return this; } - public TapOptions withNoWaitAfter(boolean noWaitAfter) { + public TapOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TapOptions withPosition(double x, double y) { - return withPosition(new Position(x, y)); + public TapOptions setPosition(double x, double y) { + return setPosition(new Position(x, y)); } - public TapOptions withPosition(Position position) { + public TapOptions setPosition(Position position) { this.position = position; return this; } - public TapOptions withTimeout(double timeout) { + public TapOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1269,7 +1269,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public TextContentOptions withTimeout(double timeout) { + public TextContentOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1292,15 +1292,15 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public TypeOptions withDelay(double delay) { + public TypeOptions setDelay(double delay) { this.delay = delay; return this; } - public TypeOptions withNoWaitAfter(boolean noWaitAfter) { + public TypeOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public TypeOptions withTimeout(double timeout) { + public TypeOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1324,15 +1324,15 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public UncheckOptions withForce(boolean force) { + public UncheckOptions setForce(boolean force) { this.force = force; return this; } - public UncheckOptions withNoWaitAfter(boolean noWaitAfter) { + public UncheckOptions setNoWaitAfter(boolean noWaitAfter) { this.noWaitAfter = noWaitAfter; return this; } - public UncheckOptions withTimeout(double timeout) { + public UncheckOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1344,7 +1344,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForCloseOptions withTimeout(double timeout) { + public WaitForCloseOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1360,11 +1360,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForConsoleMessageOptions withPredicate(Predicate predicate) { + public WaitForConsoleMessageOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForConsoleMessageOptions withTimeout(double timeout) { + public WaitForConsoleMessageOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1380,11 +1380,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForDownloadOptions withPredicate(Predicate predicate) { + public WaitForDownloadOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForDownloadOptions withTimeout(double timeout) { + public WaitForDownloadOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1400,11 +1400,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForFileChooserOptions withPredicate(Predicate predicate) { + public WaitForFileChooserOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForFileChooserOptions withTimeout(double timeout) { + public WaitForFileChooserOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1421,11 +1421,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForFunctionOptions withPollingInterval(double pollingInterval) { + public WaitForFunctionOptions setPollingInterval(double pollingInterval) { this.pollingInterval = pollingInterval; return this; } - public WaitForFunctionOptions withTimeout(double timeout) { + public WaitForFunctionOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1439,7 +1439,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForLoadStateOptions withTimeout(double timeout) { + public WaitForLoadStateOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1466,23 +1466,23 @@ public interface Page extends AutoCloseable { */ public WaitUntilState waitUntil; - public WaitForNavigationOptions withTimeout(double timeout) { + public WaitForNavigationOptions setTimeout(double timeout) { this.timeout = timeout; return this; } - public WaitForNavigationOptions withUrl(String url) { + public WaitForNavigationOptions setUrl(String url) { this.url = url; return this; } - public WaitForNavigationOptions withUrl(Pattern url) { + public WaitForNavigationOptions setUrl(Pattern url) { this.url = url; return this; } - public WaitForNavigationOptions withUrl(Predicate url) { + public WaitForNavigationOptions setUrl(Predicate url) { this.url = url; return this; } - public WaitForNavigationOptions withWaitUntil(WaitUntilState waitUntil) { + public WaitForNavigationOptions setWaitUntil(WaitUntilState waitUntil) { this.waitUntil = waitUntil; return this; } @@ -1498,11 +1498,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForPopupOptions withPredicate(Predicate predicate) { + public WaitForPopupOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForPopupOptions withTimeout(double timeout) { + public WaitForPopupOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1514,7 +1514,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForRequestOptions withTimeout(double timeout) { + public WaitForRequestOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1527,7 +1527,7 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForResponseOptions withTimeout(double timeout) { + public WaitForResponseOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1552,11 +1552,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForSelectorOptions withState(WaitForSelectorState state) { + public WaitForSelectorOptions setState(WaitForSelectorState state) { this.state = state; return this; } - public WaitForSelectorOptions withTimeout(double timeout) { + public WaitForSelectorOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1572,11 +1572,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForWebSocketOptions withPredicate(Predicate predicate) { + public WaitForWebSocketOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForWebSocketOptions withTimeout(double timeout) { + public WaitForWebSocketOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -1592,11 +1592,11 @@ public interface Page extends AutoCloseable { */ public Double timeout; - public WaitForWorkerOptions withPredicate(Predicate predicate) { + public WaitForWorkerOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForWorkerOptions withTimeout(double timeout) { + public WaitForWorkerOptions setTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Route.java b/playwright/src/main/java/com/microsoft/playwright/Route.java index c464dbb4..6e18fcc2 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Route.java +++ b/playwright/src/main/java/com/microsoft/playwright/Route.java @@ -43,23 +43,23 @@ public interface Route { */ public String url; - public ResumeOptions withHeaders(Map headers) { + public ResumeOptions setHeaders(Map headers) { this.headers = headers; return this; } - public ResumeOptions withMethod(String method) { + public ResumeOptions setMethod(String method) { this.method = method; return this; } - public ResumeOptions withPostData(String postData) { + public ResumeOptions setPostData(String postData) { this.postData = postData; return this; } - public ResumeOptions withPostData(byte[] postData) { + public ResumeOptions setPostData(byte[] postData) { this.postData = postData; return this; } - public ResumeOptions withUrl(String url) { + public ResumeOptions setUrl(String url) { this.url = url; return this; } @@ -91,27 +91,27 @@ public interface Route { */ public Integer status; - public FulfillOptions withBody(String body) { + public FulfillOptions setBody(String body) { this.body = body; return this; } - public FulfillOptions withBodyBytes(byte[] bodyBytes) { + public FulfillOptions setBodyBytes(byte[] bodyBytes) { this.bodyBytes = bodyBytes; return this; } - public FulfillOptions withContentType(String contentType) { + public FulfillOptions setContentType(String contentType) { this.contentType = contentType; return this; } - public FulfillOptions withHeaders(Map headers) { + public FulfillOptions setHeaders(Map headers) { this.headers = headers; return this; } - public FulfillOptions withPath(Path path) { + public FulfillOptions setPath(Path path) { this.path = path; return this; } - public FulfillOptions withStatus(int status) { + public FulfillOptions setStatus(int status) { this.status = status; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Selectors.java b/playwright/src/main/java/com/microsoft/playwright/Selectors.java index 6e7bfb9c..bad33ce1 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Selectors.java +++ b/playwright/src/main/java/com/microsoft/playwright/Selectors.java @@ -32,7 +32,7 @@ public interface Selectors { */ public Boolean contentScript; - public RegisterOptions withContentScript(boolean contentScript) { + public RegisterOptions setContentScript(boolean contentScript) { this.contentScript = contentScript; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/WebSocket.java b/playwright/src/main/java/com/microsoft/playwright/WebSocket.java index 73c55ee9..6981687f 100644 --- a/playwright/src/main/java/com/microsoft/playwright/WebSocket.java +++ b/playwright/src/main/java/com/microsoft/playwright/WebSocket.java @@ -72,11 +72,11 @@ public interface WebSocket { */ public Double timeout; - public WaitForFrameReceivedOptions withPredicate(Predicate predicate) { + public WaitForFrameReceivedOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForFrameReceivedOptions withTimeout(double timeout) { + public WaitForFrameReceivedOptions setTimeout(double timeout) { this.timeout = timeout; return this; } @@ -92,11 +92,11 @@ public interface WebSocket { */ public Double timeout; - public WaitForFrameSentOptions withPredicate(Predicate predicate) { + public WaitForFrameSentOptions setPredicate(Predicate predicate) { this.predicate = predicate; return this; } - public WaitForFrameSentOptions withTimeout(double timeout) { + public WaitForFrameSentOptions setTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/Worker.java b/playwright/src/main/java/com/microsoft/playwright/Worker.java index 1c58e697..084b510c 100644 --- a/playwright/src/main/java/com/microsoft/playwright/Worker.java +++ b/playwright/src/main/java/com/microsoft/playwright/Worker.java @@ -52,7 +52,7 @@ public interface Worker { */ public Double timeout; - public WaitForCloseOptions withTimeout(double timeout) { + public WaitForCloseOptions setTimeout(double timeout) { this.timeout = timeout; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/ElementHandleImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/ElementHandleImpl.java index 8dd7ef12..bbf19ff7 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/ElementHandleImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/ElementHandleImpl.java @@ -359,7 +359,7 @@ public class ElementHandleImpl extends JSHandleImpl implements ElementHandle { return selectOption(new SelectOption[0], options); } return selectOption(Arrays.asList(values).stream().map( - v -> new SelectOption().withValue(v)).toArray(SelectOption[]::new), options); + v -> new SelectOption().setValue(v)).toArray(SelectOption[]::new), options); } @Override diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java index dab022dd..b153f16c 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/FrameImpl.java @@ -106,7 +106,7 @@ public class FrameImpl extends ChannelOwner implements Frame { return selectOption(selector, new SelectOption[0], options); } return selectOption(selector, Arrays.asList(values).stream().map( - v -> new SelectOption().withValue(v)).toArray(SelectOption[]::new), options); + v -> new SelectOption().setValue(v)).toArray(SelectOption[]::new), options); } @Override diff --git a/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java b/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java index 055ec0e5..02d1bed8 100644 --- a/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java +++ b/playwright/src/main/java/com/microsoft/playwright/impl/PageImpl.java @@ -956,7 +956,7 @@ public class PageImpl extends ChannelOwner implements Page { return selectOption(selector, new SelectOption[0], options); } return selectOption(selector, Arrays.asList(values).stream().map( - v -> new SelectOption().withValue(v)).toArray(SelectOption[]::new), options); + v -> new SelectOption().setValue(v)).toArray(SelectOption[]::new), options); } @Override diff --git a/playwright/src/main/java/com/microsoft/playwright/options/Cookie.java b/playwright/src/main/java/com/microsoft/playwright/options/Cookie.java index 72ec8678..c020be1b 100644 --- a/playwright/src/main/java/com/microsoft/playwright/options/Cookie.java +++ b/playwright/src/main/java/com/microsoft/playwright/options/Cookie.java @@ -52,31 +52,31 @@ public class Cookie { this.name = name; this.value = value; } - public Cookie withUrl(String url) { + public Cookie setUrl(String url) { this.url = url; return this; } - public Cookie withDomain(String domain) { + public Cookie setDomain(String domain) { this.domain = domain; return this; } - public Cookie withPath(String path) { + public Cookie setPath(String path) { this.path = path; return this; } - public Cookie withExpires(double expires) { + public Cookie setExpires(double expires) { this.expires = expires; return this; } - public Cookie withHttpOnly(boolean httpOnly) { + public Cookie setHttpOnly(boolean httpOnly) { this.httpOnly = httpOnly; return this; } - public Cookie withSecure(boolean secure) { + public Cookie setSecure(boolean secure) { this.secure = secure; return this; } - public Cookie withSameSite(SameSiteAttribute sameSite) { + public Cookie setSameSite(SameSiteAttribute sameSite) { this.sameSite = sameSite; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/options/Geolocation.java b/playwright/src/main/java/com/microsoft/playwright/options/Geolocation.java index 356df847..df132fc5 100644 --- a/playwright/src/main/java/com/microsoft/playwright/options/Geolocation.java +++ b/playwright/src/main/java/com/microsoft/playwright/options/Geolocation.java @@ -34,7 +34,7 @@ public class Geolocation { this.latitude = latitude; this.longitude = longitude; } - public Geolocation withAccuracy(double accuracy) { + public Geolocation setAccuracy(double accuracy) { this.accuracy = accuracy; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/options/Margin.java b/playwright/src/main/java/com/microsoft/playwright/options/Margin.java index af1e97ae..48904f04 100644 --- a/playwright/src/main/java/com/microsoft/playwright/options/Margin.java +++ b/playwright/src/main/java/com/microsoft/playwright/options/Margin.java @@ -34,19 +34,19 @@ public class Margin { */ public String left; - public Margin withTop(String top) { + public Margin setTop(String top) { this.top = top; return this; } - public Margin withRight(String right) { + public Margin setRight(String right) { this.right = right; return this; } - public Margin withBottom(String bottom) { + public Margin setBottom(String bottom) { this.bottom = bottom; return this; } - public Margin withLeft(String left) { + public Margin setLeft(String left) { this.left = left; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/options/Proxy.java b/playwright/src/main/java/com/microsoft/playwright/options/Proxy.java index a4c98437..df4ca26d 100644 --- a/playwright/src/main/java/com/microsoft/playwright/options/Proxy.java +++ b/playwright/src/main/java/com/microsoft/playwright/options/Proxy.java @@ -38,15 +38,15 @@ public class Proxy { public Proxy(String server) { this.server = server; } - public Proxy withBypass(String bypass) { + public Proxy setBypass(String bypass) { this.bypass = bypass; return this; } - public Proxy withUsername(String username) { + public Proxy setUsername(String username) { this.username = username; return this; } - public Proxy withPassword(String password) { + public Proxy setPassword(String password) { this.password = password; return this; } diff --git a/playwright/src/main/java/com/microsoft/playwright/options/SelectOption.java b/playwright/src/main/java/com/microsoft/playwright/options/SelectOption.java index 7a14ae99..b9525826 100644 --- a/playwright/src/main/java/com/microsoft/playwright/options/SelectOption.java +++ b/playwright/src/main/java/com/microsoft/playwright/options/SelectOption.java @@ -30,15 +30,15 @@ public class SelectOption { */ public Integer index; - public SelectOption withValue(String value) { + public SelectOption setValue(String value) { this.value = value; return this; } - public SelectOption withLabel(String label) { + public SelectOption setLabel(String label) { this.label = label; return this; } - public SelectOption withIndex(int index) { + public SelectOption setIndex(int index) { this.index = index; return this; } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextAddCookies.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextAddCookies.java index 3f91230b..5d6620e8 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextAddCookies.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextAddCookies.java @@ -36,7 +36,7 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldWork() { page.navigate(server.EMPTY_PAGE); context.addCookies(asList( - new Cookie("password", "123456").withUrl(server.EMPTY_PAGE))); + new Cookie("password", "123456").setUrl(server.EMPTY_PAGE))); assertEquals("password=123456", page.evaluate("document.cookie")); } @@ -54,9 +54,9 @@ public class TestBrowserContextAddCookies extends TestBase { context.clearCookies(); assertEquals(emptyList(), context.cookies()); context.addCookies(asList(new Cookie(cookies.get(0).name, cookies.get(0).value) - .withDomain(cookies.get(0).domain) - .withPath(cookies.get(0).path) - .withExpires(cookies.get(0).expires) + .setDomain(cookies.get(0).domain) + .setPath(cookies.get(0).path) + .setExpires(cookies.get(0).expires) )); assertJsonEquals(new Gson().toJson(cookies), context.cookies()); } @@ -65,7 +65,7 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldSendCookieHeader() throws ExecutionException, InterruptedException { Future request = server.futureRequest("/empty.html"); context.addCookies(asList( - new Cookie("cookie", "value").withUrl(server.EMPTY_PAGE))); + new Cookie("cookie", "value").setUrl(server.EMPTY_PAGE))); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); List cookies = request.get().headers.get("cookie"); @@ -76,9 +76,9 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldIsolateCookiesInBrowserContexts() { BrowserContext anotherContext = browser.newContext(); context.addCookies(asList( - new Cookie("isolatecookie", "page1value").withUrl(server.EMPTY_PAGE))); + new Cookie("isolatecookie", "page1value").setUrl(server.EMPTY_PAGE))); anotherContext.addCookies(asList( - new Cookie("isolatecookie", "page2value").withUrl(server.EMPTY_PAGE))); + new Cookie("isolatecookie", "page2value").setUrl(server.EMPTY_PAGE))); List cookies1 = context.cookies(); List cookies2 = anotherContext.cookies(); assertEquals(1, cookies1.size()); @@ -146,7 +146,7 @@ public class TestBrowserContextAddCookies extends TestBase { @Test void shouldIsolateSendCookieHeader() throws ExecutionException, InterruptedException { context.addCookies(asList( - new Cookie("sendcookie", "value").withUrl(server.EMPTY_PAGE))); + new Cookie("sendcookie", "value").setUrl(server.EMPTY_PAGE))); { Page page = context.newPage(); Future request = server.futureRequest("/empty.html"); @@ -171,8 +171,8 @@ public class TestBrowserContextAddCookies extends TestBase { Browser browser1 = browserType.launch(); BrowserContext context1 = browser1.newContext(); context1.addCookies(asList(new Cookie("cookie-in-context-1", "value") - .withUrl(server.EMPTY_PAGE) - .withExpires(Instant.now().getEpochSecond() + + 10000))); + .setUrl(server.EMPTY_PAGE) + .setExpires(Instant.now().getEpochSecond() + + 10000))); browser1.close(); // const browser2 = browserType.launch(browserOptions); @@ -187,8 +187,8 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldSetMultipleCookies() { page.navigate(server.EMPTY_PAGE); context.addCookies(asList( - new Cookie("multiple-1", "123456").withUrl(server.EMPTY_PAGE), - new Cookie("multiple-2", "bar").withUrl(server.EMPTY_PAGE) + new Cookie("multiple-1", "123456").setUrl(server.EMPTY_PAGE), + new Cookie("multiple-2", "bar").setUrl(server.EMPTY_PAGE) )); assertEquals(asList("multiple-1=123456", "multiple-2=bar"), page.evaluate("() => {\n" + " const cookies = document.cookie.split(';');\n" + @@ -199,7 +199,7 @@ public class TestBrowserContextAddCookies extends TestBase { @Test void shouldHaveExpiresSetTo1ForSessionCookies() { context.addCookies(asList( - new Cookie("expires", "123456").withUrl(server.EMPTY_PAGE))); + new Cookie("expires", "123456").setUrl(server.EMPTY_PAGE))); List cookies = context.cookies(); assertEquals(-1, cookies.get(0).expires); } @@ -207,7 +207,7 @@ public class TestBrowserContextAddCookies extends TestBase { @Test void shouldSetCookieWithReasonableDefaults() { context.addCookies(asList( - new Cookie("defaults", "123456").withUrl(server.EMPTY_PAGE))); + new Cookie("defaults", "123456").setUrl(server.EMPTY_PAGE))); List cookies = context.cookies(); assertJsonEquals("[{\n" + " name: 'defaults',\n" + @@ -225,8 +225,8 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldSetACookieWithAPath() { page.navigate(server.PREFIX + "/grid.html"); context.addCookies(asList(new Cookie("gridcookie", "GRID") - .withDomain("localhost") - .withPath("/grid.html"))); + .setDomain("localhost") + .setPath("/grid.html"))); List cookies = context.cookies(); assertJsonEquals("[{\n" + " name: 'gridcookie',\n" + @@ -249,8 +249,8 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldNotSetACookieWithBlankPageURL() { try { context.addCookies(asList( - new Cookie("example-cookie", "best").withUrl(server.EMPTY_PAGE), - new Cookie("example-cookie-blank", "best").withUrl("about:blank") + new Cookie("example-cookie", "best").setUrl(server.EMPTY_PAGE), + new Cookie("example-cookie-blank", "best").setUrl("about:blank") )); fail("did not throw"); } catch (PlaywrightException e) { @@ -262,7 +262,7 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldNotSetACookieOnADataURLPage() { try { context.addCookies(asList( - new Cookie("example-cookie", "best").withUrl("data:,Hello%2C%20World!") + new Cookie("example-cookie", "best").setUrl("data:,Hello%2C%20World!") )); fail("did not throw"); } catch (PlaywrightException e) { @@ -275,7 +275,7 @@ public class TestBrowserContextAddCookies extends TestBase { page.navigate(server.EMPTY_PAGE); String SECURE_URL = "https://example.com"; context.addCookies(asList( - new Cookie("foo", "bar").withUrl(SECURE_URL) + new Cookie("foo", "bar").setUrl(SECURE_URL) )); List cookies = context.cookies(SECURE_URL); assertEquals(1, cookies.size()); @@ -287,7 +287,7 @@ public class TestBrowserContextAddCookies extends TestBase { page.navigate(server.EMPTY_PAGE); String HTTP_URL = "http://example.com"; context.addCookies(asList( - new Cookie("foo", "bar").withUrl(HTTP_URL) + new Cookie("foo", "bar").setUrl(HTTP_URL) )); List cookies = context.cookies(HTTP_URL); assertEquals(1, cookies.size()); @@ -298,7 +298,7 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldSetACookieOnADifferentDomain() { page.navigate(server.EMPTY_PAGE); context.addCookies(asList( - new Cookie("example-cookie", "best").withUrl("https://www.example.com") + new Cookie("example-cookie", "best").setUrl("https://www.example.com") )); assertEquals("", page.evaluate("document.cookie")); assertJsonEquals("[{\n" + @@ -317,7 +317,7 @@ public class TestBrowserContextAddCookies extends TestBase { void shouldSetCookiesForAFrame() { page.navigate(server.EMPTY_PAGE); context.addCookies(asList( - new Cookie("frame-cookie", "value").withUrl(server.PREFIX) + new Cookie("frame-cookie", "value").setUrl(server.PREFIX) )); page.evaluate("src => {\n" + " let fulfill;\n" + diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java index 0184bcc9..e2abdac4 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextBasic.java @@ -96,7 +96,7 @@ public class TestBrowserContextBasic extends TestBase { @Test void shouldPropagateDefaultViewportToThePage() { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withViewportSize(456, 789)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setViewportSize(456, 789)); Page page = context.newPage(); verifyViewport(page, 456, 789); context.close(); @@ -108,7 +108,7 @@ public class TestBrowserContextBasic extends TestBase { @Test void shouldRespectDeviceScaleFactor() { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withDeviceScaleFactor(3.0)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setDeviceScaleFactor(3.0)); Page page = context.newPage(); assertEquals(3, page.evaluate("window.devicePixelRatio")); context.close(); @@ -119,7 +119,7 @@ public class TestBrowserContextBasic extends TestBase { @Disabled("TODO: supported null viewport option") void shouldNotAllowDeviceScaleFactorWithNullViewport() { try { - browser.newContext(new Browser.NewContextOptions().withDeviceScaleFactor(1.0)); + browser.newContext(new Browser.NewContextOptions().setDeviceScaleFactor(1.0)); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("\"deviceScaleFactor\" option is not supported with null \"viewport\"")); @@ -130,7 +130,7 @@ public class TestBrowserContextBasic extends TestBase { @Disabled("TODO: supported null viewport option") void shouldNotAllowIsMobileWithNullViewport() { try { - browser.newContext(new Browser.NewContextOptions().withIsMobile(true)); + browser.newContext(new Browser.NewContextOptions().setIsMobile(true)); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("\"isMobile\" option is not supported with null \"viewport\"")); @@ -208,7 +208,7 @@ public class TestBrowserContextBasic extends TestBase { @Test void shouldDisableJavascript() { { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withJavaScriptEnabled(false)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setJavaScriptEnabled(false)); Page page = context.newPage(); page.navigate("data:text/html, "); try { @@ -234,7 +234,7 @@ public class TestBrowserContextBasic extends TestBase { @Test void shouldBeAbleToNavigateAfterDisablingJavascript() { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withJavaScriptEnabled(false)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setJavaScriptEnabled(false)); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); context.close(); @@ -242,7 +242,7 @@ public class TestBrowserContextBasic extends TestBase { @Test void shouldWorkWithOfflineOption() { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withOffline(true)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setOffline(true)); Page page = context.newPage(); try { page.navigate(server.EMPTY_PAGE); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextClearCookies.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextClearCookies.java index 01928c8a..2f7bb17d 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextClearCookies.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextClearCookies.java @@ -28,7 +28,7 @@ public class TestBrowserContextClearCookies extends TestBase { void shouldClearCookies() { page.navigate(server.EMPTY_PAGE); context.addCookies(asList( - new Cookie("cookie1", "1").withUrl(server.EMPTY_PAGE))); + new Cookie("cookie1", "1").setUrl(server.EMPTY_PAGE))); assertEquals("cookie1=1", page.evaluate("document.cookie")); context.clearCookies(); assertEquals(emptyList(), context.cookies()); @@ -40,9 +40,9 @@ public class TestBrowserContextClearCookies extends TestBase { void shouldIsolateCookiesWhenClearing() { BrowserContext anotherContext = browser.newContext(); context.addCookies(asList( - new Cookie("page1cookie", "page1value").withUrl(server.EMPTY_PAGE))); + new Cookie("page1cookie", "page1value").setUrl(server.EMPTY_PAGE))); anotherContext.addCookies(asList( - new Cookie("page2cookie", "page2value").withUrl(server.EMPTY_PAGE))); + new Cookie("page2cookie", "page2value").setUrl(server.EMPTY_PAGE))); assertEquals(1, (context.cookies()).size()); assertEquals(1, (anotherContext.cookies()).size()); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java index 052214d9..4b35bd1c 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCookies.java @@ -158,9 +158,9 @@ public class TestBrowserContextCookies extends TestBase { @Test void shouldGetCookiesFromMultipleUrls() { context.addCookies(asList( - new Cookie("doggo", "woofs").withUrl("https://foo.com"), - new Cookie("catto", "purrs").withUrl("https://bar.com"), - new Cookie("birdo", "tweets").withUrl("https://baz.com"))); + new Cookie("doggo", "woofs").setUrl("https://foo.com"), + new Cookie("catto", "purrs").setUrl("https://bar.com"), + new Cookie("birdo", "tweets").setUrl("https://baz.com"))); List cookies = context.cookies(asList("https://foo.com", "https://baz.com")); cookies.sort(Comparator.comparing(c -> c.name)); assertJsonEquals("[{\n" + diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCredentials.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCredentials.java index 4e1504c8..bf68095b 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCredentials.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextCredentials.java @@ -47,7 +47,7 @@ public class TestBrowserContextCredentials extends TestBase { void shouldWorkWithCorrectCredentials() { server.setAuth("/empty.html", "user", "pass"); BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withHttpCredentials("user", "pass")); + .setHttpCredentials("user", "pass")); Page page = context.newPage(); Response response = page.navigate(server.EMPTY_PAGE); assertEquals(200, response.status()); @@ -57,7 +57,7 @@ public class TestBrowserContextCredentials extends TestBase { @Test void shouldFailWithWrongCredentials() { server.setAuth("/empty.html", "user", "pass"); - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withHttpCredentials("foo", "bar")); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setHttpCredentials("foo", "bar")); Page page = context.newPage(); Response response = page.navigate(server.EMPTY_PAGE); assertEquals(401, response.status()); @@ -68,7 +68,7 @@ public class TestBrowserContextCredentials extends TestBase { void shouldReturnResourceBody() { server.setAuth("/playground.html", "user", "pass"); BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withHttpCredentials("user", "pass")); + .setHttpCredentials("user", "pass")); Page page = context.newPage(); Response response = page.navigate(server.PREFIX + "/playground.html"); assertEquals(200, response.status()); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextExposeFunction.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextExposeFunction.java index ce9dcd22..21dcf648 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextExposeFunction.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextExposeFunction.java @@ -100,7 +100,7 @@ public class TestBrowserContextExposeFunction extends TestBase { context.exposeBinding("logme", (source, args) -> { target[0] = (JSHandle) args[0]; return 17; - }, new BrowserContext.ExposeBindingOptions().withHandle(true)); + }, new BrowserContext.ExposeBindingOptions().setHandle(true)); Page page = context.newPage(); Object result = page.evaluate("async function() {\n" + " return window['logme']({ foo: 42 });\n" + diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java index e49e08d8..07c8a2aa 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java @@ -33,7 +33,7 @@ public class TestBrowserContextProxy extends TestBase { // Hide base class method to provide extra option. static void launchBrowser() { BrowserType.LaunchOptions options = createLaunchOptions(); - options.withProxy(new Proxy("per-context")); + options.setProxy(new Proxy("per-context")); launchBrowser(options); } @@ -41,7 +41,7 @@ public class TestBrowserContextProxy extends TestBase { void shouldThrowForMissingGlobalProxy() { Browser browser = browserType.launch(createLaunchOptions()); try { - browser.newContext(new Browser.NewContextOptions().withProxy("localhost:" + server.PORT)); + browser.newContext(new Browser.NewContextOptions().setProxy("localhost:" + server.PORT)); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Browser needs to be launched with the global proxy")); @@ -62,7 +62,7 @@ public class TestBrowserContextProxy extends TestBase { writer.write("Served by the proxy"); } }); - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withProxy("localhost:" + server.PORT)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy("localhost:" + server.PORT)); Page page = context.newPage(); page.navigate("http://non-existent.com/target.html"); assertEquals("Served by the proxy", page.title()); @@ -77,7 +77,7 @@ public class TestBrowserContextProxy extends TestBase { writer.write("Served by the proxy"); } }); - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withProxy( + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy( new Proxy("localhost:" + server.PORT))); Page page = context.newPage(); page.navigate("http://non-existent.com/target.html"); @@ -94,7 +94,7 @@ public class TestBrowserContextProxy extends TestBase { writer.write("Served by the proxy"); } }); - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withProxy( + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy( new Proxy("localhost:" + server.PORT))); Page page = context.newPage(); @@ -116,7 +116,7 @@ public class TestBrowserContextProxy extends TestBase { writer.write("Served by the proxy"); } }); - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withProxy( + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy( new Proxy("127.0.0.1:" + server.PORT))); Page page = context.newPage(); @@ -140,10 +140,10 @@ public class TestBrowserContextProxy extends TestBase { writer.write("" + auth.get(0) + ""); } }); - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withProxy( + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy( new Proxy("localhost:" + server.PORT) - .withUsername("user") - .withPassword("secret"))); + .setUsername("user") + .setPassword("secret"))); Page page = context.newPage(); page.navigate("http://non-existent.com/target.html"); assertEquals("Basic " + Base64.getEncoder().encodeToString("user:secret".getBytes()), page.title()); @@ -163,13 +163,13 @@ public class TestBrowserContextProxy extends TestBase { writer.write("Served by the proxy"); } }); - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withProxy( + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy( new Proxy("127.0.0.1:" + server.PORT) // FYI: using long and weird domain names to avoid ATT DNS hijacking // that resolves everything to some weird search results page. // // @see https://gist.github.com/CollinChaffin/24f6c9652efb3d6d5ef2f5502720ef00 - .withBypass("1.non.existent.domain.for.the.test, 2.non.existent.domain.for.the.test, .another.test"))); + .setBypass("1.non.existent.domain.for.the.test, 2.non.existent.domain.for.the.test, .another.test"))); Page page = context.newPage(); page.navigate("http://0.non.existent.domain.for.the.test/target.html"); @@ -209,7 +209,7 @@ public class TestBrowserContextProxy extends TestBase { @Test void doesLaunchWithoutAPort() { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withProxy( + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy( new Proxy("http://localhost"))); context.close(); } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextRoute.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextRoute.java index 8d7a7d05..7d87153d 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextRoute.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextRoute.java @@ -94,11 +94,11 @@ public class TestBrowserContextRoute extends TestBase { void shouldYieldToPageRoute() { BrowserContext context = browser.newContext(); context.route("**/empty.html", route -> { - route.fulfill(new Route.FulfillOptions().withStatus(200).withBody("context")); + route.fulfill(new Route.FulfillOptions().setStatus(200).setBody("context")); }); Page page = context.newPage(); page.route("**/empty.html", route -> { - route.fulfill(new Route.FulfillOptions().withStatus(200).withBody("page")); + route.fulfill(new Route.FulfillOptions().setStatus(200).setBody("page")); }); Response response = page.navigate(server.EMPTY_PAGE); assertTrue(response.ok()); @@ -110,11 +110,11 @@ public class TestBrowserContextRoute extends TestBase { void shouldFallBackToContextRoute() { BrowserContext context = browser.newContext(); context.route("**/empty.html", route -> { - route.fulfill(new Route.FulfillOptions().withStatus(200).withBody("context")); + route.fulfill(new Route.FulfillOptions().setStatus(200).setBody("context")); }); Page page = context.newPage(); page.route("**/non-empty.html", route -> { - route.fulfill(new Route.FulfillOptions().withStatus(200).withBody("page")); + route.fulfill(new Route.FulfillOptions().setStatus(200).setBody("page")); }); Response response = page.navigate(server.EMPTY_PAGE); assertTrue(response.ok()); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextStorageState.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextStorageState.java index d9121793..2da1e954 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextStorageState.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextStorageState.java @@ -36,7 +36,7 @@ public class TestBrowserContextStorageState extends TestBase { @Test void shouldCaptureLocalStorage() { page.route("**/*", route -> { - route.fulfill(new Route.FulfillOptions().withBody("")); + route.fulfill(new Route.FulfillOptions().setBody("")); }); page.navigate("https://www.example.com"); page.evaluate("localStorage['name1'] = 'value1';"); @@ -73,10 +73,10 @@ public class TestBrowserContextStorageState extends TestBase { " }\n" + " ]\n" + "}"; - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withStorageState(storageState)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setStorageState(storageState)); Page page = context.newPage(); page.route("**/*", route -> { - route.fulfill(new Route.FulfillOptions().withBody("")); + route.fulfill(new Route.FulfillOptions().setBody("")); }); page.navigate("https://www.example.com"); Object localStorage = page.evaluate("window.localStorage"); @@ -88,7 +88,7 @@ public class TestBrowserContextStorageState extends TestBase { void shouldRoundTripThroughTheFile(@TempDir Path tempDir) throws IOException { Page page1 = context.newPage(); page1.route("**/*", route -> { - route.fulfill(new Route.FulfillOptions().withBody("")); + route.fulfill(new Route.FulfillOptions().setBody("")); }); page1.navigate("https://www.example.com"); page1.evaluate("() => {\n" + @@ -97,7 +97,7 @@ public class TestBrowserContextStorageState extends TestBase { " return document.cookie;\n" + "}"); Path path = tempDir.resolve("storage-state.json"); - context.storageState(new BrowserContext.StorageStateOptions().withPath(path)); + context.storageState(new BrowserContext.StorageStateOptions().setPath(path)); JsonObject expected = new Gson().fromJson( "{\n" + " \"cookies\":[\n" + @@ -124,10 +124,10 @@ public class TestBrowserContextStorageState extends TestBase { try (InputStreamReader reader = new InputStreamReader(new FileInputStream(path.toFile()), StandardCharsets.UTF_8)) { assertEquals(expected, new Gson().fromJson(reader, JsonObject.class)); } - BrowserContext context2 = browser.newContext(new Browser.NewContextOptions().withStorageStatePath(path)); + BrowserContext context2 = browser.newContext(new Browser.NewContextOptions().setStorageStatePath(path)); Page page2 = context2.newPage(); page2.route("**/*", route -> { - route.fulfill(new Route.FulfillOptions().withBody("")); + route.fulfill(new Route.FulfillOptions().setBody("")); }); page2.navigate("https://www.example.com"); Object localStorage = page2.evaluate("window.localStorage"); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextViewport.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextViewport.java index 514c44b1..fb4616b1 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextViewport.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextViewport.java @@ -97,7 +97,7 @@ public class TestBrowserContextViewport extends TestBase { @Test void shouldSupportTouchWithNullViewport() { Browser.NewContextOptions options = new Browser.NewContextOptions() - .withHasTouch(true).withViewportSize(null); + .setHasTouch(true).setViewportSize(null); BrowserContext context = browser.newContext(options); Page page = context.newPage(); page.navigate(server.PREFIX + "/mobile.html"); @@ -107,7 +107,7 @@ public class TestBrowserContextViewport extends TestBase { @Test void shouldReportNullViewPortSizeWhenGivenNullViewport() { - Browser.NewContextOptions options = new Browser.NewContextOptions().withViewportSize(null); + Browser.NewContextOptions options = new Browser.NewContextOptions().setViewportSize(null); BrowserContext context = browser.newContext(options); Page page = context.newPage(); assertNull(page.viewportSize()); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserTypeConnect.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserTypeConnect.java index 44c94cc5..5ddf9000 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserTypeConnect.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserTypeConnect.java @@ -202,7 +202,7 @@ public class TestBrowserTypeConnect extends TestBase { server.setRoute("/one-style.css", r -> {}); page.onRequest(r -> remote.close()); try { - page.navigate(server.PREFIX + "/one-style.html", new Page.NavigateOptions().withTimeout(60000)); + page.navigate(server.PREFIX + "/one-style.html", new Page.NavigateOptions().setTimeout(60000)); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Playwright connection closed")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestClick.java b/playwright/src/test/java/com/microsoft/playwright/TestClick.java index b6cadf52..8be6c150 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestClick.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestClick.java @@ -100,7 +100,7 @@ public class TestClick extends TestBase { @Test void shouldClickWithDisabledJavascript() { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withJavaScriptEnabled(false)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setJavaScriptEnabled(false)); Page page = context.newPage(); page.navigate(server.PREFIX + "/wrappedlink.html"); @@ -129,7 +129,7 @@ public class TestClick extends TestBase { page.navigate(server.PREFIX + "/input/textarea.html"); String text = "This is the text that we are going to try to select. Let's see how it goes."; page.fill("textarea", text); - page.click("textarea", new Page.ClickOptions().withClickCount(3)); + page.click("textarea", new Page.ClickOptions().setClickCount(3)); assertEquals(text, page.evaluate("() => {\n" + " const textarea = document.querySelector('textarea');\n" + " return textarea.value.substring(textarea.selectionStart, textarea.selectionEnd);\n" + @@ -174,7 +174,7 @@ public class TestClick extends TestBase { page.evalOnSelector("button", "b => b.style.display = 'none'"); Exception exception = null; try { - page.click("button", new Page.ClickOptions().withForce(true)); + page.click("button", new Page.ClickOptions().setForce(true)); } catch (PlaywrightException e) { exception = e; } @@ -241,8 +241,8 @@ public class TestClick extends TestBase { void shouldNotHangWithTouchEnabledViewports() { // @see https://github.com/GoogleChrome/puppeteer/issues/161 BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withViewportSize(375, 667) - .withHasTouch(true)); + .setViewportSize(375, 667) + .setHasTouch(true)); Page page = context.newPage(); page.mouse().down(); page.mouse().move(100, 10); @@ -297,7 +297,7 @@ public class TestClick extends TestBase { @Test void shouldFireContextmenuEventOnRightClick() { page.navigate(server.PREFIX + "/input/scrollable.html"); - page.click("#button-8", new Page.ClickOptions().withButton(RIGHT)); + page.click("#button-8", new Page.ClickOptions().setButton(RIGHT)); assertEquals("context menu", page.evaluate("() => document.querySelector('#button-8').textContent")); } @@ -340,8 +340,8 @@ public class TestClick extends TestBase { @Test void shouldClickTheButtonWithDeviceScaleFactorSet() { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withViewportSize(400, 400) - .withDeviceScaleFactor(5.0)); + .setViewportSize(400, 400) + .setDeviceScaleFactor(5.0)); Page page = context.newPage(); assertEquals(5, page.evaluate("() => window.devicePixelRatio")); page.setContent("
spacer
"); @@ -357,7 +357,7 @@ public class TestClick extends TestBase { void shouldClickTheButtonWithPxBorderWithOffset() { page.navigate(server.PREFIX + "/input/button.html"); page.evalOnSelector("button", "button => button.style.borderWidth = '8px'"); - page.click("button", new Page.ClickOptions().withPosition(20, 10)); + page.click("button", new Page.ClickOptions().setPosition(20, 10)); assertEquals(page.evaluate("result"), "Clicked"); // Safari reports border-relative offsetX/offsetY. assertEquals(isWebKit() ? 20 + 8 : 20, page.evaluate("offsetX")); @@ -369,7 +369,7 @@ public class TestClick extends TestBase { page.navigate(server.PREFIX + "/input/button.html"); page.evalOnSelector("button", "button => button.style.borderWidth = '2em'"); page.evalOnSelector("button", "button => button.style.fontSize = '12px'"); - page.click("button", new Page.ClickOptions().withPosition(20, 10)); + page.click("button", new Page.ClickOptions().setPosition(20, 10)); assertEquals("Clicked", page.evaluate("result")); // Safari reports border-relative offsetX/offsetY. assertEquals(isWebKit() ? 12 * 2 + 20 : 20, page.evaluate("offsetX")); @@ -381,7 +381,7 @@ public class TestClick extends TestBase { page.navigate(server.PREFIX + "/input/button.html"); page.evalOnSelector("button", "button => button.style.borderWidth = '8px'"); page.evalOnSelector("button", "button => button.style.height = button.style.width = '2000px'"); - page.click("button", new Page.ClickOptions().withPosition(1900, 1910)); + page.click("button", new Page.ClickOptions().setPosition(1900, 1910)); assertEquals("Clicked", page.evaluate("() => window['result']")); // Safari reports border-relative offsetX/offsetY. assertEquals(isWebKit() ? 1900 + 8 : 1900, page.evaluate("offsetX")); @@ -402,7 +402,7 @@ public class TestClick extends TestBase { " button.style.width = '2000px';\n" + " button.style.borderWidth = '8px';\n" + "}"); - page.click("button", new Page.ClickOptions().withPosition(1900, 1910)); + page.click("button", new Page.ClickOptions().setPosition(1900, 1910)); assertEquals("Clicked", page.evaluate("() => window['result']")); // Safari reports border-relative offsetX/offsetY. assertEquals(isWebKit() ? 1900 + 8 : 1900, page.evaluate("offsetX")); @@ -413,15 +413,15 @@ public class TestClick extends TestBase { @DisabledIf(value="com.microsoft.playwright.TestBase#isFirefox", disabledReason="skip") void shouldClickTheButtonWithOffsetWithPageScale() { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withViewportSize(400, 400) - .withIsMobile(true)); + .setViewportSize(400, 400) + .setIsMobile(true)); Page page = context.newPage(); page.navigate(server.PREFIX + "/input/button.html"); page.evalOnSelector("button", "button => {\n" + " button.style.borderWidth = '8px';\n" + " document.body.style.margin = '0';\n" + "}"); - page.click("button", new Page.ClickOptions().withPosition(20, 10)); + page.click("button", new Page.ClickOptions().setPosition(20, 10)); assertEquals("Clicked", page.evaluate("result")); // 20;10 + 8px of border in each direction int expectedX = 28; @@ -478,7 +478,7 @@ public class TestClick extends TestBase { " blocker.style.top = '0';\n" + " document.body.appendChild(blocker);\n" + "}"); - button.click(new ElementHandle.ClickOptions().withForce(true)); + button.click(new ElementHandle.ClickOptions().setForce(true)); assertEquals("Was not clicked", page.evaluate("window['result']")); } @@ -533,13 +533,13 @@ public class TestClick extends TestBase { @Test void shouldUpdateModifiersCorrectly() { page.navigate(server.PREFIX + "/input/button.html"); - page.click("button", new Page.ClickOptions().withModifiers(asList(SHIFT))); + page.click("button", new Page.ClickOptions().setModifiers(asList(SHIFT))); assertEquals(true, page.evaluate("shiftKey")); - page.click("button", new Page.ClickOptions().withModifiers(emptyList())); + page.click("button", new Page.ClickOptions().setModifiers(emptyList())); assertEquals(false, page.evaluate("shiftKey")); page.keyboard().down("Shift"); - page.click("button", new Page.ClickOptions().withModifiers(emptyList())); + page.click("button", new Page.ClickOptions().setModifiers(emptyList())); assertEquals(false, page.evaluate("shiftKey")); page.click("button"); assertEquals(true, page.evaluate("shiftKey")); @@ -565,7 +565,7 @@ public class TestClick extends TestBase { ElementHandle handle = page.querySelector("button"); page.evaluate("stopButton(true)"); try { - handle.click(new ElementHandle.ClickOptions().withForce(true)); + handle.click(new ElementHandle.ClickOptions().setForce(true)); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Element is not attached to the DOM")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestDefaultBrowserContext2.java b/playwright/src/test/java/com/microsoft/playwright/TestDefaultBrowserContext2.java index 99fc07af..298d583e 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestDefaultBrowserContext2.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestDefaultBrowserContext2.java @@ -49,7 +49,7 @@ public class TestDefaultBrowserContext2 extends TestBase { @Test void shouldSupportHasTouchOption() { - Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().withHasTouch(true)); + Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().setHasTouch(true)); page.navigate(server.PREFIX + "/mobile.html"); assertEquals(true, page.evaluate("() => 'ontouchstart' in window")); } @@ -59,14 +59,14 @@ public class TestDefaultBrowserContext2 extends TestBase { void shouldWorkInPersistentContext() { // Firefox does not support mobile. Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions() - .withViewportSize(320, 480).withIsMobile(true)); + .setViewportSize(320, 480).setIsMobile(true)); page.navigate(server.PREFIX + "/empty.html"); assertEquals(980, page.evaluate("() => window.innerWidth")); } @Test void shouldSupportColorSchemeOption() { - Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().withColorScheme(DARK)); + Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().setColorScheme(DARK)); assertEquals(false, page.evaluate("matchMedia('(prefers-color-scheme: light)').matches")); assertEquals(true, page.evaluate("matchMedia('(prefers-color-scheme: dark)').matches")); } @@ -74,7 +74,7 @@ public class TestDefaultBrowserContext2 extends TestBase { @Test void shouldSupportTimezoneIdOption() { Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions() - .withLocale("en-US").withTimezoneId("America/Jamaica")); + .setLocale("en-US").setTimezoneId("America/Jamaica")); assertEquals("Sat Nov 19 2016 13:12:34 GMT-0500 (Eastern Standard Time)", page.evaluate("new Date(1479579154987).toString()")); } @@ -82,15 +82,15 @@ public class TestDefaultBrowserContext2 extends TestBase { @Test void shouldSupportLocaleOption() { Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions() - .withLocale("fr-CH")); + .setLocale("fr-CH")); assertEquals("fr-CH", page.evaluate("navigator.language")); } @Test void shouldSupportGeolocationAndPermissionsOptions() { Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions() - .withGeolocation(new Geolocation(10, 10)) - .withPermissions(asList("geolocation"))); + .setGeolocation(new Geolocation(10, 10)) + .setPermissions(asList("geolocation"))); page.navigate(server.EMPTY_PAGE); Object geolocation = page.evaluate("() => new Promise(resolve => navigator.geolocation.getCurrentPosition(position => {\n" + " resolve({latitude: position.coords.latitude, longitude: position.coords.longitude});\n" + @@ -101,7 +101,7 @@ public class TestDefaultBrowserContext2 extends TestBase { // @Test void shouldSupportIgnoreHTTPSErrorsOption() { // TODO: net::ERR_EMPTY_RESPONSE at https://localhost:8908/empty.html -// Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().withIgnoreHTTPSErrors(true)); +// Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().setIgnoreHTTPSErrors(true)); // Response response = page.navigate(httpsServer.EMPTY_PAGE); // assertTrue(response.ok()); } @@ -109,7 +109,7 @@ public class TestDefaultBrowserContext2 extends TestBase { @Test void shouldSupportExtraHTTPHeadersOption() throws ExecutionException, InterruptedException { // TODO: test.flaky(browserName === "firefox" && headful && platform === "linux", "Intermittent timeout on bots"); - Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().withExtraHTTPHeaders(mapOf("foo", "bar"))); + Page page = launchPersistent(new BrowserType.LaunchPersistentContextOptions().setExtraHTTPHeaders(mapOf("foo", "bar"))); Future request = server.futureRequest("/empty.html"); page.navigate(server.EMPTY_PAGE); assertEquals(asList("bar"), request.get().headers.get("foo")); @@ -190,7 +190,7 @@ public class TestDefaultBrowserContext2 extends TestBase { @DisabledIf(value="com.microsoft.playwright.TestBase#isFirefox", disabledReason="skip") void shouldThrowIfPageArgumentIsPassed() throws IOException { BrowserType.LaunchPersistentContextOptions options = new BrowserType.LaunchPersistentContextOptions() - .withArgs(asList(server.EMPTY_PAGE)); + .setArgs(asList(server.EMPTY_PAGE)); Path userDataDir = Files.createTempDirectory("user-data-dir-"); try { browserType.launchPersistentContext(userDataDir, options); @@ -203,12 +203,12 @@ public class TestDefaultBrowserContext2 extends TestBase { @Test void shouldWorkWithIgnoreDefaultArgs() { // Ignore arguments by name. - BrowserType.LaunchOptions options = new BrowserType.LaunchOptions().withIgnoreDefaultArgs(asList("foo")); + BrowserType.LaunchOptions options = new BrowserType.LaunchOptions().setIgnoreDefaultArgs(asList("foo")); Browser browser = browserType.launch(options); Page page = browser.newPage(); browser.close(); // Check that there is a way to ignore all arguments. - new BrowserType.LaunchOptions().withIgnoreAllDefaultArgs(true); + new BrowserType.LaunchOptions().setIgnoreAllDefaultArgs(true); } void shouldHavePassedURLWhenLaunchingWithIgnoreDefaultArgsTrue() { diff --git a/playwright/src/test/java/com/microsoft/playwright/TestDownload.java b/playwright/src/test/java/com/microsoft/playwright/TestDownload.java index 70660117..1965f7b8 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestDownload.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestDownload.java @@ -76,7 +76,7 @@ public class TestDownload extends TestBase { } @Test void shouldReportDownloadsWithAcceptDownloadsTrue() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); Path path = download.path(); @@ -88,7 +88,7 @@ public class TestDownload extends TestBase { @Test void shouldSaveToUserSpecifiedPath() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); @@ -102,7 +102,7 @@ public class TestDownload extends TestBase { @Test void shouldSaveToUserSpecifiedPathWithoutUpdatingOriginalPath() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); @@ -125,7 +125,7 @@ public class TestDownload extends TestBase { @Test void shouldSaveToTwoDifferentPathsWithMultipleSaveAsCalls() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); { @@ -147,7 +147,7 @@ public class TestDownload extends TestBase { @Test void shouldSaveToOverwrittenFilepath() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); Path userFile = Files.createTempFile("download-", ".txt"); @@ -168,7 +168,7 @@ public class TestDownload extends TestBase { @Test void shouldCreateSubdirectoriesWhenSavingToNonExistentUserSpecifiedPath() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); @@ -187,7 +187,7 @@ public class TestDownload extends TestBase { @Test void shouldErrorWhenSavingWithDownloadsDisabled() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(false)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(false)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); @@ -203,7 +203,7 @@ public class TestDownload extends TestBase { @Test void shouldErrorWhenSavingAfterDeletion() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); @@ -233,7 +233,7 @@ public class TestDownload extends TestBase { } }); - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.navigate(server.EMPTY_PAGE); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); @@ -248,7 +248,7 @@ public class TestDownload extends TestBase { @Test void shouldReportDownloadPathWithinPageOnDownloadHandlerForFiles() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); @SuppressWarnings("unchecked") Download[] download = {null}; @@ -268,7 +268,7 @@ public class TestDownload extends TestBase { @Test void shouldReportDownloadPathWithinPageOnDownloadHandlerForBlobs() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); @SuppressWarnings("unchecked") Download[] download = {null}; page.onDownload(d -> download[0] = d); @@ -298,9 +298,9 @@ public class TestDownload extends TestBase { writer.write("Hello world"); } }); - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); - Download download = page.waitForDownload(() -> page.click("a", new Page.ClickOptions().withModifiers(asList(ALT)))); + Download download = page.waitForDownload(() -> page.click("a", new Page.ClickOptions().setModifiers(asList(ALT)))); Path path = download.path(); assertTrue(Files.exists(path)); byte[] bytes = readAllBytes(path); @@ -319,7 +319,7 @@ public class TestDownload extends TestBase { // TODO: - the test fails in headful Chromium as the popup page gets closed along // with the session before download completed event arrives. // - WebKit doesn't close the popup page - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); Path path = download.path(); @@ -331,7 +331,7 @@ public class TestDownload extends TestBase { @Test void shouldDeleteFile() { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); Path path = download.path(); @@ -343,7 +343,7 @@ public class TestDownload extends TestBase { @Test void shouldExposeStream() throws IOException { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download = page.waitForDownload(() -> page.click("a")); @@ -356,7 +356,7 @@ public class TestDownload extends TestBase { @Test void shouldDeleteDownloadsOnContextDestruction() { - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download1 = page.waitForDownload(() -> page.click("a")); Download download2 = page.waitForDownload(() -> page.click("a")); @@ -372,7 +372,7 @@ public class TestDownload extends TestBase { @Test void shouldDeleteDownloadsOnBrowserGone() { Browser browser = browserType.launch(); - Page page = browser.newPage(new Browser.NewPageOptions().withAcceptDownloads(true)); + Page page = browser.newPage(new Browser.NewPageOptions().setAcceptDownloads(true)); page.setContent("download"); Download download1 = page.waitForDownload(() -> page.click("a")); Download download2 = page.waitForDownload(() -> page.click("a")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleBoundingBox.java b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleBoundingBox.java index d8a339f5..fa4acd92 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleBoundingBox.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleBoundingBox.java @@ -99,7 +99,7 @@ public class TestElementHandleBoundingBox extends TestBase { @DisabledIf(value="com.microsoft.playwright.TestBase#isFirefox", disabledReason="skip") void shouldWorkWithPageScale() { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withViewportSize(400, 400).withIsMobile(true)); + .setViewportSize(400, 400).setIsMobile(true)); Page page = context.newPage(); page.navigate(server.PREFIX + "/input/button.html"); ElementHandle button = page.querySelector("button"); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleClick.java b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleClick.java index 96fe273e..83ec17cf 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleClick.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleClick.java @@ -74,7 +74,7 @@ public class TestElementHandleClick extends TestBase { ElementHandle button = page.querySelector("button"); page.evaluate("button => button.style.display = 'none'", button); try { - button.click(new ElementHandle.ClickOptions().withForce(true)); + button.click(new ElementHandle.ClickOptions().setForce(true)); fail("click should throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Element is not visible")); @@ -87,7 +87,7 @@ public class TestElementHandleClick extends TestBase { ElementHandle button = page.querySelector("button"); page.evaluate("button => button.parentElement.style.display = 'none'", button); try { - button.click(new ElementHandle.ClickOptions().withForce(true)); + button.click(new ElementHandle.ClickOptions().setForce(true)); fail("click should throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Element is not visible")); @@ -99,7 +99,7 @@ public class TestElementHandleClick extends TestBase { page.setContent("hello
goodbye"); ElementHandle br = page.querySelector("br"); try { - br.click(new ElementHandle.ClickOptions().withForce(true)); + br.click(new ElementHandle.ClickOptions().setForce(true)); fail("click should throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Element is outside of the viewport")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleSelectText.java b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleSelectText.java index a816f444..7c9658c0 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleSelectText.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleSelectText.java @@ -48,7 +48,7 @@ public class TestElementHandleSelectText extends TestBase { ElementHandle textarea = page.querySelector("textarea"); textarea.evaluate("e => e.style.display = 'none'"); try { - textarea.selectText(new ElementHandle.SelectTextOptions().withTimeout(3000)); + textarea.selectText(new ElementHandle.SelectTextOptions().setTimeout(3000)); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("element is not visible")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleWaitForElementState.java b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleWaitForElementState.java index 7b4d42b4..e06a0da8 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestElementHandleWaitForElementState.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestElementHandleWaitForElementState.java @@ -52,7 +52,7 @@ public class TestElementHandleWaitForElementState extends TestBase { page.setContent("
content
"); ElementHandle div = page.querySelector("div"); try { - div.waitForElementState(VISIBLE, new ElementHandle.WaitForElementStateOptions().withTimeout(1000)); + div.waitForElementState(VISIBLE, new ElementHandle.WaitForElementStateOptions().setTimeout(1000)); fail("did not throw"); } catch (TimeoutError e) { assertTrue(e.getMessage().contains("Timeout 1000ms exceeded")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestFrameNavigate.java b/playwright/src/test/java/com/microsoft/playwright/TestFrameNavigate.java index 3bb2f97b..494e5fde 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestFrameNavigate.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestFrameNavigate.java @@ -44,7 +44,7 @@ public class TestFrameNavigate extends TestBase { server.setRoute("/frames/script.js", (httpExchange) -> {}); String url = server.PREFIX + "/frames/child-redirect.html"; try { - page.navigate(url, new Page.NavigateOptions().withTimeout(5000).withWaitUntil(NETWORKIDLE)); + page.navigate(url, new Page.NavigateOptions().setTimeout(5000).setWaitUntil(NETWORKIDLE)); } catch (TimeoutError e) { assertTrue(e.getMessage().contains("Timeout 5000ms exceeded.")); assertTrue(e.getMessage().contains("navigating to \"" + url +"\", waiting until \"networkidle\"")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestGeolocation.java b/playwright/src/test/java/com/microsoft/playwright/TestGeolocation.java index 24ee706f..92659fdd 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestGeolocation.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestGeolocation.java @@ -55,8 +55,8 @@ public class TestGeolocation extends TestBase { page.navigate(server.EMPTY_PAGE); BrowserContext context2 = browser.newContext(new Browser.NewContextOptions() - .withPermissions(asList("geolocation")) - .withGeolocation(new Geolocation(20, 20))); + .setPermissions(asList("geolocation")) + .setGeolocation(new Geolocation(20, 20))); Page page2 = context2.newPage(); page2.navigate(server.EMPTY_PAGE); @@ -79,7 +79,7 @@ public class TestGeolocation extends TestBase { @Test void shouldNotModifyPassedDefaultOptionsObject() { Geolocation geolocation = new Geolocation(10, 10); - Browser.NewContextOptions options = new Browser.NewContextOptions().withGeolocation(geolocation); + Browser.NewContextOptions options = new Browser.NewContextOptions().setGeolocation(geolocation); BrowserContext context = browser.newContext(options); context.setGeolocation(new Geolocation(20, 20)); assertEquals(geolocation, options.geolocation); @@ -93,8 +93,8 @@ public class TestGeolocation extends TestBase { @Test void shouldUseContextOptions() { Browser.NewContextOptions options = new Browser.NewContextOptions() - .withGeolocation(new Geolocation(10, 10)) - .withPermissions(asList("geolocation")); + .setGeolocation(new Geolocation(10, 10)) + .setPermissions(asList("geolocation")); BrowserContext context = browser.newContext(options); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestHar.java b/playwright/src/test/java/com/microsoft/playwright/TestHar.java index 4cb5bed7..4fd6b03b 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestHar.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestHar.java @@ -43,7 +43,7 @@ public class TestHar extends TestBase { PageWithHar() throws IOException { harFile = Files.createTempFile("test-", ".har"); context = browser.newContext(new Browser.NewContextOptions() - .withRecordHarPath(harFile).withIgnoreHTTPSErrors(true)); + .setRecordHarPath(harFile).setIgnoreHTTPSErrors(true)); page = context.newPage(); } @@ -112,7 +112,7 @@ public class TestHar extends TestBase { Path userDataDir = Files.createTempDirectory("user-data-dir-"); BrowserContext context = browserType.launchPersistentContext(userDataDir, new BrowserType.LaunchPersistentContextOptions() - .withRecordHarPath(harPath).withIgnoreHTTPSErrors(true)); + .setRecordHarPath(harPath).setIgnoreHTTPSErrors(true)); Page page = context.pages().get(0); page.navigate("data:text/html,Hello"); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestLaunch.java b/playwright/src/test/java/com/microsoft/playwright/TestLaunch.java index f94a95e3..4b0c9b60 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestLaunch.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestLaunch.java @@ -36,7 +36,7 @@ public class TestLaunch extends TestBase { @Test void passEnvVar() { BrowserType.LaunchOptions options = new BrowserType.LaunchOptions(); - options.withEnv(mapOf("DEBUG", "pw:protocol")); + options.setEnv(mapOf("DEBUG", "pw:protocol")); launchBrowser(options); } } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java b/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java index 85ea374e..53b3d0ea 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageBasic.java @@ -72,7 +72,7 @@ public class TestPageBasic extends TestBase { } dialog.accept(); }); - newPage.close(new Page.CloseOptions().withRunBeforeUnload(true)); + newPage.close(new Page.CloseOptions().setRunBeforeUnload(true)); for (int i = 0; i < 300; i++) { if (didShowDialog[0]) { break; diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageEmulateMedia.java b/playwright/src/test/java/com/microsoft/playwright/TestPageEmulateMedia.java index e6075385..6ec6e34a 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageEmulateMedia.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageEmulateMedia.java @@ -31,13 +31,13 @@ public class TestPageEmulateMedia extends TestBase { void shouldEmulateType() { assertEquals(true, page.evaluate("() => matchMedia('screen').matches")); assertEquals(false, page.evaluate("() => matchMedia('print').matches")); - page.emulateMedia(new Page.EmulateMediaOptions().withMedia(PRINT)); + page.emulateMedia(new Page.EmulateMediaOptions().setMedia(PRINT)); assertEquals(false, page.evaluate("() => matchMedia('screen').matches")); assertEquals(true, page.evaluate("() => matchMedia('print').matches")); page.emulateMedia(new Page.EmulateMediaOptions()); assertEquals(false, page.evaluate("() => matchMedia('screen').matches")); assertEquals(true, page.evaluate("() => matchMedia('print').matches")); - page.emulateMedia(new Page.EmulateMediaOptions().withMedia(null)); + page.emulateMedia(new Page.EmulateMediaOptions().setMedia(null)); assertEquals(true, page.evaluate("() => matchMedia('screen').matches")); assertEquals(false, page.evaluate("() => matchMedia('print').matches")); } @@ -48,10 +48,10 @@ public class TestPageEmulateMedia extends TestBase { @Test void shouldEmulateSchemeWork() { - page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(LIGHT)); + page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(LIGHT)); assertEquals(true, page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches")); assertEquals(false, page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches")); - page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(DARK)); + page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(DARK)); assertEquals(true, page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches")); assertEquals(false, page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches")); } @@ -61,11 +61,11 @@ public class TestPageEmulateMedia extends TestBase { assertEquals(true, page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches")); assertEquals(false, page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches")); - page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(DARK)); + page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(DARK)); assertEquals(true, page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches")); assertEquals(false, page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches")); - page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(null)); + page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(null)); assertEquals(false, page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches")); assertEquals(true, page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches")); } @@ -82,7 +82,7 @@ public class TestPageEmulateMedia extends TestBase { @Test void shouldWorkInPopup() { { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withColorScheme(DARK)); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setColorScheme(DARK)); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); Page popup = page.waitForPopup(() -> @@ -92,7 +92,7 @@ public class TestPageEmulateMedia extends TestBase { context.close(); } { - Page page = browser.newPage(new Browser.NewPageOptions().withColorScheme(LIGHT)); + Page page = browser.newPage(new Browser.NewPageOptions().setColorScheme(LIGHT)); page.navigate(server.EMPTY_PAGE); Page popup = page.waitForPopup(() -> page.evaluate("url => { window.open(url); }", server.EMPTY_PAGE)); @@ -104,7 +104,7 @@ public class TestPageEmulateMedia extends TestBase { @Test void shouldWorkInCrossProcessIframe() { - Page page = browser.newPage(new Browser.NewPageOptions().withColorScheme(DARK)); + Page page = browser.newPage(new Browser.NewPageOptions().setColorScheme(DARK)); page.navigate(server.EMPTY_PAGE); attachFrame(page, "frame1", server.CROSS_PROCESS_PREFIX + "/empty.html"); Frame frame = page.frames().get(1); @@ -134,13 +134,13 @@ public class TestPageEmulateMedia extends TestBase { return page.evalOnSelector("div", "div => window.getComputedStyle(div).backgroundColor"); }; - page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(LIGHT)); + page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(LIGHT)); assertEquals("rgb(255, 255, 255)", backgroundColor.get()); - page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(DARK)); + page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(DARK)); assertEquals("rgb(0, 0, 0)", backgroundColor.get()); - page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(LIGHT)); + page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(LIGHT)); assertEquals("rgb(255, 255, 255)", backgroundColor.get()); } } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageExposeFunction.java b/playwright/src/test/java/com/microsoft/playwright/TestPageExposeFunction.java index 0e06a349..4a128f4d 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageExposeFunction.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageExposeFunction.java @@ -170,7 +170,7 @@ public class TestPageExposeFunction extends TestBase { page.exposeBinding("logme", (source, args) -> { target[0] = (JSHandle) args[0]; return 17; - }, new Page.ExposeBindingOptions().withHandle(true)); + }, new Page.ExposeBindingOptions().setHandle(true)); Object result = page.evaluate("async function() {\n" + " return window['logme']({ foo: 42 });\n" + "}"); @@ -182,10 +182,10 @@ public class TestPageExposeFunction extends TestBase { void exposeBindingHandleShouldNotThrowDuringNavigation() { page.exposeBinding("logme", (source, args) -> { return 17; - }, new Page.ExposeBindingOptions().withHandle(true)); + }, new Page.ExposeBindingOptions().setHandle(true)); page.navigate(server.EMPTY_PAGE); - page.waitForNavigation(new Page.WaitForNavigationOptions().withWaitUntil(LOAD), () -> { + page.waitForNavigation(new Page.WaitForNavigationOptions().setWaitUntil(LOAD), () -> { page.evaluate("async url => {\n" + " window['logme']({ foo: 42 });\n" + " window.location.href = url;\n" + @@ -208,7 +208,7 @@ public class TestPageExposeFunction extends TestBase { void exposeBindingHandleShouldThrowForMultipleArguments() { page.exposeBinding("logme", (source, args) -> { return 17; - }, new Page.ExposeBindingOptions().withHandle(true)); + }, new Page.ExposeBindingOptions().setHandle(true)); assertEquals(17, page.evaluate("async function() {\n" + " return window['logme']({ foo: 42 });\n" + "}")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageRoute.java b/playwright/src/test/java/com/microsoft/playwright/TestPageRoute.java index e6685fe7..fc1b53fc 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageRoute.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageRoute.java @@ -112,7 +112,7 @@ public class TestPageRoute extends TestBase { page.route("**/*", route -> { Map headers = new HashMap<>(route.request().headers()); headers.put("foo", "bar"); - route.resume(new Route.ResumeOptions().withHeaders(headers)); + route.resume(new Route.ResumeOptions().setHeaders(headers)); }); page.navigate(server.PREFIX + "/rrredirect"); } @@ -124,7 +124,7 @@ public class TestPageRoute extends TestBase { page.route("**/*", route -> { Map headers = new HashMap<>(route.request().headers()); headers.remove("foo"); - route.resume(new Route.ResumeOptions().withHeaders(headers)); + route.resume(new Route.ResumeOptions().setHeaders(headers)); }); Future serverRequest = server.futureRequest("/title.html"); @@ -150,7 +150,7 @@ public class TestPageRoute extends TestBase { // Setup cookie. page.navigate(server.EMPTY_PAGE); context.addCookies(asList(new Cookie("foo", "bar") - .withUrl(server.EMPTY_PAGE))); + .setUrl(server.EMPTY_PAGE))); // Setup request interception. page.route("**/*", route -> route.resume()); Response response = page.reload(); @@ -474,8 +474,8 @@ public class TestPageRoute extends TestBase { return; } route.fulfill(new Route.FulfillOptions() - .withStatus(301) - .withHeaders(mapOf("location", "/empty.html"))); + .setStatus(301) + .setHeaders(mapOf("location", "/empty.html"))); }); Object text = page.evaluate("async url => {\n" + " const data = await fetch(url);\n" + @@ -493,10 +493,10 @@ public class TestPageRoute extends TestBase { headers.put("access-control-allow-origin", "*"); } route.fulfill(new Route.FulfillOptions() - .withStatus(200) - .withContentType("application/json") - .withHeaders(headers) - .withBody("[\"electric\",\"gas\"]")); + .setStatus(200) + .setContentType("application/json") + .setHeaders(headers) + .setBody("[\"electric\",\"gas\"]")); }); @@ -527,10 +527,10 @@ public class TestPageRoute extends TestBase { page.navigate(server.EMPTY_PAGE); page.route("**/cars", route -> { route.fulfill(new Route.FulfillOptions() - .withStatus(200) - .withContentType("application/json") - .withHeaders(mapOf("Access-Control-Allow-Origin", "*")) - .withBody("[\"electric\",\"gas\"]")); + .setStatus(200) + .setContentType("application/json") + .setHeaders(mapOf("Access-Control-Allow-Origin", "*")) + .setBody("[\"electric\",\"gas\"]")); }); Object resp = page.evaluate("async () => {\n" + " const response = await fetch('https://example.com/cars', {\n" + @@ -549,11 +549,11 @@ public class TestPageRoute extends TestBase { page.navigate(server.EMPTY_PAGE); page.route("**/cars", route -> { route.fulfill(new Route.FulfillOptions() - .withStatus(200) - .withContentType("application/json") - .withHeaders(mapOf("Access-Control-Allow-Origin", server.PREFIX, + .setStatus(200) + .setContentType("application/json") + .setHeaders(mapOf("Access-Control-Allow-Origin", server.PREFIX, "Access-Control-Allow-Credentials", "true")) - .withBody("[\"electric\",\"gas\"]")); + .setBody("[\"electric\",\"gas\"]")); }); Object resp = page.evaluate("async () => {\n" + " const response = await fetch('https://example.com/cars', {\n" + @@ -573,12 +573,12 @@ public class TestPageRoute extends TestBase { page.navigate(server.EMPTY_PAGE); page.route("**/cars", route -> { route.fulfill(new Route.FulfillOptions() - .withStatus(200) - .withContentType("application/json") + .setStatus(200) + .setContentType("application/json") // Should fail without this line below! // "Access-Control-Allow-Credentials": "true" - .withHeaders(mapOf("Access-Control-Allow-Origin", server.PREFIX)) - .withBody("[\"electric\",\"gas\"]")); + .setHeaders(mapOf("Access-Control-Allow-Origin", server.PREFIX)) + .setBody("[\"electric\",\"gas\"]")); }); try { page.evaluate("async () => {\n" + @@ -601,10 +601,10 @@ public class TestPageRoute extends TestBase { page.navigate(server.EMPTY_PAGE); page.route("**/cars", route -> { route.fulfill(new Route.FulfillOptions() - .withStatus(200) - .withContentType("application/json") - .withHeaders(mapOf("Access-Control-Allow-Origin", "*")) - .withBody("[\"" + route.request().method() + "\",\"electric\",\"gas\"]")); + .setStatus(200) + .setContentType("application/json") + .setHeaders(mapOf("Access-Control-Allow-Origin", "*")) + .setBody("[\"" + route.request().method() + "\",\"electric\",\"gas\"]")); }); // First POST { diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java b/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java index 1b71f794..be693e52 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageScreenshot.java @@ -44,7 +44,7 @@ public class TestPageScreenshot extends TestBase { page.setViewportSize(500, 500); page.navigate(server.PREFIX + "/grid.html"); byte[] screenshot = page.screenshot(new Page.ScreenshotOptions() - .withClip(new Clip(50, 100, 150, 100))); + .setClip(new Clip(50, 100, 150, 100))); BufferedImage image = ImageIO.read(new ByteArrayInputStream(screenshot)); assertEquals(150, image.getWidth()); assertEquals(100, image.getHeight()); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageSelectOption.java b/playwright/src/test/java/com/microsoft/playwright/TestPageSelectOption.java index 6faef722..210e6711 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageSelectOption.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageSelectOption.java @@ -38,7 +38,7 @@ public class TestPageSelectOption extends TestBase { @Test void shouldSelectSingleOptionByValue() { page.navigate(server.PREFIX + "/input/select.html"); - page.selectOption("select", new SelectOption().withValue("blue")); + page.selectOption("select", new SelectOption().setValue("blue")); assertEquals(asList("blue"), page.evaluate("() => window['result'].onInput")); assertEquals(asList("blue"), page.evaluate("() => window['result'].onChange")); } @@ -46,7 +46,7 @@ public class TestPageSelectOption extends TestBase { @Test void shouldSelectSingleOptionByLabel() { page.navigate(server.PREFIX + "/input/select.html"); - page.selectOption("select", new SelectOption().withLabel("Indigo")); + page.selectOption("select", new SelectOption().setLabel("Indigo")); assertEquals(asList("indigo"), page.evaluate("() => window['result'].onInput")); assertEquals(asList("indigo"), page.evaluate("() => window['result'].onChange")); } @@ -62,7 +62,7 @@ public class TestPageSelectOption extends TestBase { @Test void shouldSelectSingleOptionByIndex() { page.navigate(server.PREFIX + "/input/select.html"); - page.selectOption("select", new SelectOption().withIndex(2)); + page.selectOption("select", new SelectOption().setIndex(2)); assertEquals(asList("brown"), page.evaluate("() => window['result'].onInput")); assertEquals(asList("brown"), page.evaluate("() => window['result'].onChange")); } @@ -70,7 +70,7 @@ public class TestPageSelectOption extends TestBase { @Test void shouldSelectSingleOptionByMultipleAttributes() { page.navigate(server.PREFIX + "/input/select.html"); - page.selectOption("select", new SelectOption().withValue("green").withLabel("Green")); + page.selectOption("select", new SelectOption().setValue("green").setLabel("Green")); assertEquals(asList("green"), page.evaluate("() => window['result'].onInput")); assertEquals(asList("green"), page.evaluate("() => window['result'].onChange")); } @@ -81,7 +81,7 @@ public class TestPageSelectOption extends TestBase { page.evalOnSelector("select", "s => s.value = undefined"); try { page.selectOption("select", new SelectOption() - .withValue("green").withLabel("Brown"), new Page.SelectOptionOptions().withTimeout(300)); + .setValue("green").setLabel("Brown"), new Page.SelectOptionOptions().setTimeout(300)); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Timeout")); } @@ -118,9 +118,9 @@ public class TestPageSelectOption extends TestBase { page.navigate(server.PREFIX + "/input/select.html"); page.evaluate("() => window['makeMultiple']()"); page.selectOption("select", new SelectOption[] { - new SelectOption().withValue("blue"), - new SelectOption().withLabel("Green"), - new SelectOption().withIndex(4), + new SelectOption().setValue("blue"), + new SelectOption().setLabel("Green"), + new SelectOption().setIndex(4), }); assertEquals(asList("blue", "gray", "green"), page.evaluate("() => window['result'].onInput")); assertEquals(asList("blue", "gray", "green"), page.evaluate("() => window['result'].onChange")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageSetExtraHttpHeaders.java b/playwright/src/test/java/com/microsoft/playwright/TestPageSetExtraHttpHeaders.java index 57a92ad8..95233d91 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageSetExtraHttpHeaders.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageSetExtraHttpHeaders.java @@ -58,7 +58,7 @@ public class TestPageSetExtraHttpHeaders extends TestBase { @Test void shouldOverrideExtraHeadersFromBrowserContext() throws ExecutionException, InterruptedException { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withExtraHTTPHeaders(mapOf("fOo", "bAr", "baR", "foO"))); + .setExtraHTTPHeaders(mapOf("fOo", "bAr", "baR", "foO"))); Page page = context.newPage(); page.setExtraHTTPHeaders(mapOf("Foo", "Bar")); Future request = server.futureRequest("/empty.html"); @@ -71,7 +71,7 @@ public class TestPageSetExtraHttpHeaders extends TestBase { @Test void shouldThrowForNonStringHeaderValues() { try { - browser.newContext(new Browser.NewContextOptions().withExtraHTTPHeaders(mapOf("foo", null))); + browser.newContext(new Browser.NewContextOptions().setExtraHTTPHeaders(mapOf("foo", null))); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("expected string, got undefined")); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java b/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java index cedf5256..7971068c 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageSetInputFiles.java @@ -127,7 +127,7 @@ public class TestPageSetInputFiles extends TestBase { @Test void shouldRespectTimeout() { try { - page.waitForFileChooser(new Page.WaitForFileChooserOptions().withTimeout(1), () -> {}); + page.waitForFileChooser(new Page.WaitForFileChooserOptions().setTimeout(1), () -> {}); fail("did not throw"); } catch (TimeoutError e) { assertTrue(e.getMessage().contains("Timeout 1ms exceeded")); @@ -149,7 +149,7 @@ public class TestPageSetInputFiles extends TestBase { void shouldPrioritizeExactTimeoutOverDefaultTimeout() { page.setDefaultTimeout(0); try { - page.waitForFileChooser(new Page.WaitForFileChooserOptions().withTimeout(1), () -> {}); + page.waitForFileChooser(new Page.WaitForFileChooserOptions().setTimeout(1), () -> {}); fail("did not throw"); } catch (TimeoutError e) { assertTrue(e.getMessage().contains("Timeout 1ms exceeded")); @@ -158,7 +158,7 @@ public class TestPageSetInputFiles extends TestBase { @Test void shouldWorkWithNoTimeout() { - FileChooser fileChooser = page.waitForFileChooser(new Page.WaitForFileChooserOptions().withTimeout(0), () -> { + FileChooser fileChooser = page.waitForFileChooser(new Page.WaitForFileChooserOptions().setTimeout(0), () -> { page.evaluate("() => setTimeout(() => {\n" + " const el = document.createElement('input');\n" + " el.type = 'file';\n" + diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java index 06f0bdd6..b7fba458 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForNavigation.java @@ -42,7 +42,7 @@ public class TestPageWaitForNavigation extends TestBase { void shouldRespectTimeout() { try { page.waitForNavigation( - new Page.WaitForNavigationOptions().withUrl("**/frame.html").withTimeout(5000), + new Page.WaitForNavigationOptions().setUrl("**/frame.html").setTimeout(5000), () -> page.navigate(server.EMPTY_PAGE)); fail("did not throw"); } catch (TimeoutError e) { @@ -151,19 +151,19 @@ public class TestPageWaitForNavigation extends TestBase { page.navigate(server.EMPTY_PAGE); Response response1 = page.waitForNavigation( - new Page.WaitForNavigationOptions().withUrl("**/one-style.html"), + new Page.WaitForNavigationOptions().setUrl("**/one-style.html"), () -> page.navigate(server.PREFIX + "/one-style.html")); assertNotNull(response1); assertEquals(server.PREFIX + "/one-style.html", response1.url()); Response response2 = page.waitForNavigation( - new Page.WaitForNavigationOptions().withUrl(Pattern.compile("frame.html$")), + new Page.WaitForNavigationOptions().setUrl(Pattern.compile("frame.html$")), () -> page.navigate(server.PREFIX + "/frame.html")); assertNotNull(response2); assertEquals(server.PREFIX + "/frame.html", response2.url()); Response response3 = page.waitForNavigation( - new Page.WaitForNavigationOptions().withUrl(url -> { + new Page.WaitForNavigationOptions().setUrl(url -> { try { return new URL(url).getQuery().contains("foo=bar"); } catch (MalformedURLException e) { @@ -178,7 +178,7 @@ public class TestPageWaitForNavigation extends TestBase { @Test void shouldWorkWithUrlMatchForSameDocumentNavigations() { page.navigate(server.EMPTY_PAGE); - Response response = page.waitForNavigation(new Page.WaitForNavigationOptions().withUrl("**/third.html"), () -> { + Response response = page.waitForNavigation(new Page.WaitForNavigationOptions().setUrl("**/third.html"), () -> { page.evaluate("() => {\n" + " history.pushState({}, '', '/first.html');\n" + "}"); @@ -197,7 +197,7 @@ public class TestPageWaitForNavigation extends TestBase { page.navigate(server.EMPTY_PAGE); String url = server.CROSS_PROCESS_PREFIX + "/empty.html"; Response response = page.waitForNavigation( - new Page.WaitForNavigationOptions().withWaitUntil(WaitUntilState.DOMCONTENTLOADED), + new Page.WaitForNavigationOptions().setWaitUntil(WaitUntilState.DOMCONTENTLOADED), () -> page.navigate(url)); assertEquals(url, response.url()); assertEquals(url, page.url()); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForRequest.java b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForRequest.java index 75dd86b4..5e20a973 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForRequest.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForRequest.java @@ -53,7 +53,7 @@ public class TestPageWaitForRequest extends TestBase { @Test void shouldRespectTimeout() { try { - page.waitForRequest(url -> false, new Page.WaitForRequestOptions().withTimeout(1), () -> {}); + page.waitForRequest(url -> false, new Page.WaitForRequestOptions().setTimeout(1), () -> {}); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Timeout"), e.getMessage()); @@ -76,7 +76,7 @@ public class TestPageWaitForRequest extends TestBase { page.navigate(server.EMPTY_PAGE); Request request = page.waitForRequest( server.PREFIX + "/digits/2.png", - new Page.WaitForRequestOptions().withTimeout(0),() -> { + new Page.WaitForRequestOptions().setTimeout(0),() -> { page.evaluate("() => setTimeout(() => {\n" + " fetch('/digits/1.png');\n" + " fetch('/digits/2.png');\n" + diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForResponse.java b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForResponse.java index e9aa9262..04adcad7 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForResponse.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPageWaitForResponse.java @@ -76,7 +76,7 @@ public class TestPageWaitForResponse extends TestBase { page.navigate(server.EMPTY_PAGE); Response response = page.waitForResponse( server.PREFIX + "/digits/2.png", - new Page.WaitForResponseOptions().withTimeout(0), + new Page.WaitForResponseOptions().setTimeout(0), () -> { page.evaluate("() => setTimeout(() => {\n" + " fetch('/digits/1.png');\n" + diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPdf.java b/playwright/src/test/java/com/microsoft/playwright/TestPdf.java index 6ec01840..e83bb85b 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPdf.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPdf.java @@ -33,7 +33,7 @@ public class TestPdf extends TestBase { @DisabledIf(value="com.microsoft.playwright.TestBase#isHeadful", disabledReason="skip") void shouldBeAbleToSaveFile(@TempDir Path tempDir) throws IOException { Path path = tempDir.resolve("output.pdf"); - page.pdf(new Page.PdfOptions().withPath(path)); + page.pdf(new Page.PdfOptions().setPath(path)); long size = Files.size(path); assertTrue(size > 0); } @@ -43,7 +43,7 @@ public class TestPdf extends TestBase { @DisabledIf(value="com.microsoft.playwright.TestBase#isHeadful", disabledReason="skip") void shouldSupportFractionalScaleValue(@TempDir Path tempDir) throws IOException { Path path = tempDir.resolve("output.pdf"); - page.pdf(new Page.PdfOptions().withPath(path).withScale(0.5)); + page.pdf(new Page.PdfOptions().setPath(path).setScale(0.5)); long size = Files.size(path); assertTrue(size > 0); } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestPopup.java b/playwright/src/test/java/com/microsoft/playwright/TestPopup.java index a622536e..8be276de 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestPopup.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestPopup.java @@ -32,7 +32,7 @@ public class TestPopup extends TestBase { @Test void shouldInheritUserAgentFromBrowserContext() throws ExecutionException, InterruptedException { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withUserAgent("hey")); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setUserAgent("hey")); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); page.setContent("link"); @@ -67,7 +67,7 @@ public class TestPopup extends TestBase { void shouldInheritExtraHeadersFromBrowserContext() throws ExecutionException, InterruptedException { @SuppressWarnings("unchecked") BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withExtraHTTPHeaders(mapOf("foo", "bar"))); + .setExtraHTTPHeaders(mapOf("foo", "bar"))); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); Future requestPromise = server.futureRequest("/dummy.html"); @@ -95,7 +95,7 @@ public class TestPopup extends TestBase { void shouldInheritHttpCredentialsFromBrowserContext() { server.setAuth("/title.html", "user", "pass"); BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withHttpCredentials("user", "pass")); + .setHttpCredentials("user", "pass")); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); Page popup = page.waitForPopup(() -> page.evaluate( @@ -108,8 +108,8 @@ public class TestPopup extends TestBase { @Test void shouldInheritTouchSupportFromBrowserContext() { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withViewportSize(400, 500) - .withHasTouch(true)); + .setViewportSize(400, 500) + .setHasTouch(true)); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); Object hasTouch = page.evaluate("() => {\n" + @@ -123,7 +123,7 @@ public class TestPopup extends TestBase { @Test void shouldInheritViewportSizeFromBrowserContext() { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withViewportSize(400, 500)); + .setViewportSize(400, 500)); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); Object size = page.evaluate("() => {\n" + @@ -137,7 +137,7 @@ public class TestPopup extends TestBase { @Test void shouldUseViewportSizeFromWindowFeatures() { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withViewportSize(700, 700)); + .setViewportSize(700, 700)); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); Object[] size = {null}; diff --git a/playwright/src/test/java/com/microsoft/playwright/TestRequestContinue.java b/playwright/src/test/java/com/microsoft/playwright/TestRequestContinue.java index e3bb20da..16c5dc82 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestRequestContinue.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestRequestContinue.java @@ -40,7 +40,7 @@ public class TestRequestContinue extends TestBase { page.route("**/*", route -> { Map headers = new HashMap<>(route.request().headers()); headers.put("FOO", "bar"); - route.resume(new Route.ResumeOptions().withHeaders(headers)); + route.resume(new Route.ResumeOptions().setHeaders(headers)); }); page.navigate(server.EMPTY_PAGE); Future request = server.futureRequest("/sleep.zzz"); @@ -52,7 +52,7 @@ public class TestRequestContinue extends TestBase { void shouldAmendMethod() throws ExecutionException, InterruptedException { Future sRequest = server.futureRequest("/sleep.zzz"); page.navigate(server.EMPTY_PAGE); - page.route("**/*", route -> route.resume(new Route.ResumeOptions().withMethod("POST"))); + page.route("**/*", route -> route.resume(new Route.ResumeOptions().setMethod("POST"))); Future request = server.futureRequest("/sleep.zzz"); page.evaluate("() => fetch('/sleep.zzz')"); assertEquals("POST", request.get().method); @@ -63,7 +63,7 @@ public class TestRequestContinue extends TestBase { void shouldOverrideRequestUrl() throws ExecutionException, InterruptedException { Future serverRequest = server.futureRequest("/global-var.html"); page.route("**/foo", route -> { - route.resume(new Route.ResumeOptions().withUrl(server.PREFIX + "/global-var.html")); + route.resume(new Route.ResumeOptions().setUrl(server.PREFIX + "/global-var.html")); }); Response response = page.navigate(server.PREFIX + "/foo"); assertEquals(server.PREFIX + "/foo", response.url()); @@ -76,7 +76,7 @@ public class TestRequestContinue extends TestBase { PlaywrightException[] error = {null}; page.route("**/*", route -> { try { - route.resume(new Route.ResumeOptions().withUrl("file:///tmp/foo")); + route.resume(new Route.ResumeOptions().setUrl("file:///tmp/foo")); } catch (PlaywrightException e) { error[0] = e; route.resume(); @@ -91,7 +91,7 @@ public class TestRequestContinue extends TestBase { void shouldOverrideMethodAlongWithUrl() throws ExecutionException, InterruptedException { Future serverRequest = server.futureRequest("/empty.html"); page.route("**/foo", route -> { - route.resume(new Route.ResumeOptions().withUrl(server.EMPTY_PAGE).withMethod("POST")); + route.resume(new Route.ResumeOptions().setUrl(server.EMPTY_PAGE).setMethod("POST")); }); page.navigate(server.PREFIX + "/foo"); assertEquals("POST", serverRequest.get().method); @@ -100,7 +100,7 @@ public class TestRequestContinue extends TestBase { @Test void shouldAmendMethodOnMainRequest() throws ExecutionException, InterruptedException { Future request = server.futureRequest("/empty.html"); - page.route("**/*", route -> route.resume(new Route.ResumeOptions().withMethod("POST"))); + page.route("**/*", route -> route.resume(new Route.ResumeOptions().setMethod("POST"))); page.navigate(server.EMPTY_PAGE); assertEquals("POST", request.get().method); } @@ -109,7 +109,7 @@ public class TestRequestContinue extends TestBase { void shouldAmendPostData() throws ExecutionException, InterruptedException { page.navigate(server.EMPTY_PAGE); page.route("**/*", route -> { - route.resume(new Route.ResumeOptions().withPostData("doggo")); + route.resume(new Route.ResumeOptions().setPostData("doggo")); }); Future serverRequest = server.futureRequest("/sleep.zzz"); page.evaluate("() => fetch('/sleep.zzz', { method: 'POST', body: 'birdy' })"); @@ -120,7 +120,7 @@ public class TestRequestContinue extends TestBase { void shouldAmendUtf8PostData() throws ExecutionException, InterruptedException { page.navigate(server.EMPTY_PAGE); page.route("**/*", route -> { - route.resume(new Route.ResumeOptions().withPostData("пушкин")); + route.resume(new Route.ResumeOptions().setPostData("пушкин")); }); Future serverRequest = server.futureRequest("/sleep.zzz"); page.evaluate("() => fetch('/sleep.zzz', { method: 'POST', body: 'birdy' })"); @@ -132,7 +132,7 @@ public class TestRequestContinue extends TestBase { void shouldAmendLongerPostData() throws ExecutionException, InterruptedException { page.navigate(server.EMPTY_PAGE); page.route("**/*", route -> { - route.resume(new Route.ResumeOptions().withPostData("doggo-is-longer-than-birdy")); + route.resume(new Route.ResumeOptions().setPostData("doggo-is-longer-than-birdy")); }); Future serverRequest = server.futureRequest("/sleep.zzz"); page.evaluate("() => fetch('/sleep.zzz', { method: 'POST', body: 'birdy' })"); @@ -148,7 +148,7 @@ public class TestRequestContinue extends TestBase { arr[i] = (byte) i; } page.route("**/*", route -> { - route.resume(new Route.ResumeOptions().withPostData(arr)); + route.resume(new Route.ResumeOptions().setPostData(arr)); }); Future serverRequest = server.futureRequest("/sleep.zzz"); page.evaluate("() => fetch('/sleep.zzz', { method: 'POST', body: 'birdy' })"); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestRequestFulfill.java b/playwright/src/test/java/com/microsoft/playwright/TestRequestFulfill.java index 8e67352a..76e3bb47 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestRequestFulfill.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestRequestFulfill.java @@ -31,10 +31,10 @@ public class TestRequestFulfill extends TestBase { void shouldWork() { page.route("**/*", route -> { route.fulfill(new Route.FulfillOptions() - .withStatus(201) - .withContentType("text/html") - .withHeaders(mapOf("foo", "bar")) - .withBody("Yo, page!")); + .setStatus(201) + .setContentType("text/html") + .setHeaders(mapOf("foo", "bar")) + .setBody("Yo, page!")); }); Response response = page.navigate(server.EMPTY_PAGE); assertEquals(201, response.status()); @@ -46,8 +46,8 @@ public class TestRequestFulfill extends TestBase { void shouldWorkWithStatusCode422() { page.route("**/*", route -> { route.fulfill(new Route.FulfillOptions() - .withStatus(422) - .withBody("Yo, page!")); + .setStatus(422) + .setBody("Yo, page!")); }); Response response = page.navigate(server.EMPTY_PAGE); assertEquals(422, response.status()); @@ -71,8 +71,8 @@ public class TestRequestFulfill extends TestBase { throw new RuntimeException(e); } route.fulfill(new Route.FulfillOptions() - .withContentType("image/png") - .withBodyBytes(imageBuffer)); + .setContentType("image/png") + .setBodyBytes(imageBuffer)); }); page.evaluate("PREFIX => {\n" + " const img = document.createElement('img');\n" + @@ -90,8 +90,8 @@ public class TestRequestFulfill extends TestBase { // Firefox headful produces a different image. page.route("**/*", route -> { route.fulfill(new Route.FulfillOptions() - .withContentType("image/svg+xml ; charset=utf-8") - .withBody("")); + .setContentType("image/svg+xml ; charset=utf-8") + .setBody("")); }); page.evaluate("PREFIX => {\n" + " const img = document.createElement('img');\n" + diff --git a/playwright/src/test/java/com/microsoft/playwright/TestScreencast.java b/playwright/src/test/java/com/microsoft/playwright/TestScreencast.java index d1d7e866..21e3142a 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestScreencast.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestScreencast.java @@ -28,8 +28,8 @@ public class TestScreencast extends TestBase { @Test void shouldExposeVideoPath(@TempDir Path videosDir) { BrowserContext context = browser.newContext(new Browser.NewContextOptions() - .withRecordVideoDir(videosDir).withRecordVideoSize(320, 240) - .withViewportSize(320, 240)); + .setRecordVideoDir(videosDir).setRecordVideoSize(320, 240) + .setViewportSize(320, 240)); Page page = context.newPage(); page.evaluate("() => document.body.style.backgroundColor = 'red'"); Path path = page.video().path(); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestSelectorsRegister.java b/playwright/src/test/java/com/microsoft/playwright/TestSelectorsRegister.java index 49eb4362..85dd0bc5 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestSelectorsRegister.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestSelectorsRegister.java @@ -82,7 +82,7 @@ public class TestSelectorsRegister extends TestBase { " }\n" + "}"; playwright.selectors().register("main", createDummySelector); - playwright.selectors().register("isolated", createDummySelector, new Selectors.RegisterOptions().withContentScript(true)); + playwright.selectors().register("isolated", createDummySelector, new Selectors.RegisterOptions().setContentScript(true)); page.setContent("
"); page.evaluate("() => window['__answer'] = document.querySelector('span')"); // Works in main if asked. diff --git a/playwright/src/test/java/com/microsoft/playwright/TestTap.java b/playwright/src/test/java/com/microsoft/playwright/TestTap.java index fe75cec9..5dc8a983 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestTap.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestTap.java @@ -33,7 +33,7 @@ public class TestTap extends TestBase { @Override BrowserContext createContext() { - return browser.newContext(new Browser.NewContextOptions().withHasTouch(true)); + return browser.newContext(new Browser.NewContextOptions().setHasTouch(true)); } private JSHandle trackEvents(ElementHandle target) { @@ -132,7 +132,7 @@ public class TestTap extends TestBase { " }, {passive: false});\n" + " });\n" + "}"); - page.tap("body", new Page.TapOptions().withModifiers(asList(ALT))); + page.tap("body", new Page.TapOptions().setModifiers(asList(ALT))); Object altKey = page.evaluate("() => window.touchPromise"); assertEquals(true, altKey); } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestWaitForFunction.java b/playwright/src/test/java/com/microsoft/playwright/TestWaitForFunction.java index 53776c03..e3452314 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestWaitForFunction.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestWaitForFunction.java @@ -64,7 +64,7 @@ public class TestWaitForFunction extends TestBase { " return false;\n" + " }\n" + " return Date.now() - window[\"__startTime\"];\n" + - "}", null, new Page.WaitForFunctionOptions().withPollingInterval(polling)); + "}", null, new Page.WaitForFunctionOptions().setPollingInterval(polling)); int delta = (int) timeDelta.evaluate("h => h"); assertTrue(delta >= polling); } @@ -78,7 +78,7 @@ public class TestWaitForFunction extends TestBase { JSHandle result = page.waitForFunction("() => {\n" + " window['counter'] = (window['counter'] || 0) + 1;\n" + " console.log(window['counter']);\n" + - "}", null, new Page.WaitForFunctionOptions().withPollingInterval(1).withTimeout(1000)); + "}", null, new Page.WaitForFunctionOptions().setPollingInterval(1).setTimeout(1000)); fail("did not throw"); } catch (TimeoutError e) { assertTrue(e.getMessage().contains("Timeout 1000ms exceeded")); @@ -150,7 +150,7 @@ public class TestWaitForFunction extends TestBase { @Test void shouldThrowNegativePollingInterval() { try { - page.waitForFunction("() => !!document.body", null, new Page.WaitForFunctionOptions().withPollingInterval(-10)); + page.waitForFunction("() => !!document.body", null, new Page.WaitForFunctionOptions().setPollingInterval(-10)); fail("did not throw"); } catch (PlaywrightException e) { assertTrue(e.getMessage().contains("Cannot poll with non-positive interval")); @@ -178,7 +178,7 @@ public class TestWaitForFunction extends TestBase { @Test void shouldRespectTimeout() { try { - page.waitForFunction("false", null, new Page.WaitForFunctionOptions().withTimeout(10)); + page.waitForFunction("false", null, new Page.WaitForFunctionOptions().setTimeout(10)); fail("did not throw"); } catch (TimeoutError e) { assertTrue(e.getMessage().contains("Timeout 10ms exceeded")); @@ -201,7 +201,7 @@ public class TestWaitForFunction extends TestBase { page.waitForFunction("() => {\n" + " window['__counter'] = (window['__counter'] || 0) + 1;\n" + " return window['__counter'] > 10;\n" + - "}", null, new Page.WaitForFunctionOptions().withTimeout(0).withPollingInterval(10)); + "}", null, new Page.WaitForFunctionOptions().setTimeout(0).setPollingInterval(10)); } @Test diff --git a/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java b/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java index 9d43078c..e3d0ca54 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestWorkers.java @@ -175,7 +175,7 @@ public class TestWorkers extends TestBase { @Test void shouldFormatNumberUsingContextLocale() { - BrowserContext context = browser.newContext(new Browser.NewContextOptions().withLocale("ru-RU")); + BrowserContext context = browser.newContext(new Browser.NewContextOptions().setLocale("ru-RU")); Page page = context.newPage(); page.navigate(server.EMPTY_PAGE); Worker worker = page.waitForWorker(() -> page.evaluate( diff --git a/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java index 9ed075ad..93acd882 100644 --- a/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java +++ b/tools/api-generator/src/main/java/com/microsoft/playwright/tools/ApiGenerator.java @@ -785,8 +785,8 @@ class Field extends Element { args.add(f.name); } if (!params.isEmpty()) { - output.add(offset + "public " + parentClass + " with" + toTitle(name) + "(" + String.join(", ", params) + ") {"); - output.add(offset + " return with" + toTitle(name) + "(new " + type.toJava() + "(" + String.join(", ", args) + "));"); + output.add(offset + "public " + parentClass + " set" + toTitle(name) + "(" + String.join(", ", params) + ") {"); + output.add(offset + " return set" + toTitle(name) + "(new " + type.toJava() + "(" + String.join(", ", args) + "));"); output.add(offset + "}"); } } @@ -795,7 +795,7 @@ class Field extends Element { } private void writeGenericBuilderMethod(List output, String offset, String parentClass, String paramType) { - output.add(offset + "public " + parentClass + " with" + toTitle(name) + "(" + paramType + " " + name + ") {"); + output.add(offset + "public " + parentClass + " set" + toTitle(name) + "(" + paramType + " " + name + ") {"); String rvalue = type.isNullable() ? "Optional.ofNullable(" + name + ")" : name; output.add(offset + " this." + name + " = " + rvalue + ";"); output.add(offset + " return this;");