mirror of
https://github.com/microsoft/playwright-java.git
synced 2025-12-29 02:40:42 +00:00
chore: update javadocs to reference set* methods (#328)
This commit is contained in:
parent
71b5865d5e
commit
10da11cd7c
@ -256,7 +256,7 @@ public interface BrowserContext extends AutoCloseable {
|
||||
* public static void main(String[] args) {
|
||||
* try (Playwright playwright = Playwright.create()) {
|
||||
* BrowserType webkit = playwright.webkit()
|
||||
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().withHeadless(false));
|
||||
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
|
||||
* BrowserContext context = browser.newContext();
|
||||
* context.exposeBinding("pageURL", (source, args) -> source.page().url());
|
||||
* Page page = context.newPage();
|
||||
@ -279,7 +279,7 @@ public interface BrowserContext extends AutoCloseable {
|
||||
* ElementHandle element = (ElementHandle) args[0];
|
||||
* System.out.println(element.textContent());
|
||||
* return null;
|
||||
* }, new BrowserContext.ExposeBindingOptions().withHandle(true));
|
||||
* }, new BrowserContext.ExposeBindingOptions().setHandle(true));
|
||||
* page.setContent("" +
|
||||
* "<script>\n" +
|
||||
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
|
||||
@ -315,7 +315,7 @@ public interface BrowserContext extends AutoCloseable {
|
||||
* public static void main(String[] args) {
|
||||
* try (Playwright playwright = Playwright.create()) {
|
||||
* BrowserType webkit = playwright.webkit()
|
||||
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().withHeadless(false));
|
||||
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
|
||||
* BrowserContext context = browser.newContext();
|
||||
* context.exposeBinding("pageURL", (source, args) -> source.page().url());
|
||||
* Page page = context.newPage();
|
||||
@ -338,7 +338,7 @@ public interface BrowserContext extends AutoCloseable {
|
||||
* ElementHandle element = (ElementHandle) args[0];
|
||||
* System.out.println(element.textContent());
|
||||
* return null;
|
||||
* }, new BrowserContext.ExposeBindingOptions().withHandle(true));
|
||||
* }, new BrowserContext.ExposeBindingOptions().setHandle(true));
|
||||
* page.setContent("" +
|
||||
* "<script>\n" +
|
||||
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
|
||||
@ -376,7 +376,7 @@ public interface BrowserContext extends AutoCloseable {
|
||||
* public static void main(String[] args) {
|
||||
* try (Playwright playwright = Playwright.create()) {
|
||||
* BrowserType webkit = playwright.webkit()
|
||||
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().withHeadless(false));
|
||||
* Browser browser = webkit.launch(new BrowserType.LaunchOptions().setHeadless(false));
|
||||
* context.exposeFunction("sha1", args -> {
|
||||
* String text = (String) args[0];
|
||||
* MessageDigest crypto;
|
||||
|
||||
@ -556,7 +556,7 @@ public interface BrowserType {
|
||||
* <pre>{@code
|
||||
* // Or "firefox" or "webkit".
|
||||
* Browser browser = chromium.launch(new BrowserType.LaunchOptions()
|
||||
* .withIgnoreDefaultArgs(Arrays.asList("--mute-audio")));
|
||||
* .setIgnoreDefaultArgs(Arrays.asList("--mute-audio")));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> > **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works
|
||||
@ -588,7 +588,7 @@ public interface BrowserType {
|
||||
* <pre>{@code
|
||||
* // Or "firefox" or "webkit".
|
||||
* Browser browser = chromium.launch(new BrowserType.LaunchOptions()
|
||||
* .withIgnoreDefaultArgs(Arrays.asList("--mute-audio")));
|
||||
* .setIgnoreDefaultArgs(Arrays.asList("--mute-audio")));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> > **Chromium-only** Playwright can also be used to control the Google Chrome or Microsoft Edge browsers, but it works
|
||||
|
||||
@ -1130,7 +1130,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1153,7 +1153,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1174,7 +1174,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1197,7 +1197,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1218,7 +1218,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1241,7 +1241,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1262,7 +1262,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1285,7 +1285,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1306,7 +1306,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1329,7 +1329,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1350,7 +1350,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1373,7 +1373,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* // single selection matching the value
|
||||
* handle.selectOption("blue");
|
||||
* // single selection matching the label
|
||||
* handle.selectOption(new SelectOption().withLabel("Blue"));
|
||||
* handle.selectOption(new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* handle.selectOption(new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1515,7 +1515,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* <p> To press a special key, like {@code Control} or {@code ArrowDown}, use {@link ElementHandle#press ElementHandle.press()}.
|
||||
* <pre>{@code
|
||||
* elementHandle.type("Hello"); // Types instantly
|
||||
* elementHandle.type("World", new ElementHandle.TypeOptions().withDelay(100)); // Types slower, like a user
|
||||
* elementHandle.type("World", new ElementHandle.TypeOptions().setDelay(100)); // Types slower, like a user
|
||||
* }</pre>
|
||||
*
|
||||
* <p> An example of typing into a text field and then submitting the form:
|
||||
@ -1536,7 +1536,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* <p> To press a special key, like {@code Control} or {@code ArrowDown}, use {@link ElementHandle#press ElementHandle.press()}.
|
||||
* <pre>{@code
|
||||
* elementHandle.type("Hello"); // Types instantly
|
||||
* elementHandle.type("World", new ElementHandle.TypeOptions().withDelay(100)); // Types slower, like a user
|
||||
* elementHandle.type("World", new ElementHandle.TypeOptions().setDelay(100)); // Types slower, like a user
|
||||
* }</pre>
|
||||
*
|
||||
* <p> An example of typing into a text field and then submitting the form:
|
||||
@ -1652,7 +1652,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* ElementHandle div = page.querySelector("div");
|
||||
* // Waiting for the "span" selector relative to the div.
|
||||
* ElementHandle span = div.waitForSelector("span", new ElementHandle.WaitForSelectorOptions()
|
||||
* .withState(WaitForSelectorState.ATTACHED));
|
||||
* .setState(WaitForSelectorState.ATTACHED));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> This method does not work across navigations, use {@link Page#waitForSelector Page.waitForSelector()} instead.
|
||||
@ -1676,7 +1676,7 @@ public interface ElementHandle extends JSHandle {
|
||||
* ElementHandle div = page.querySelector("div");
|
||||
* // Waiting for the "span" selector relative to the div.
|
||||
* ElementHandle span = div.waitForSelector("span", new ElementHandle.WaitForSelectorOptions()
|
||||
* .withState(WaitForSelectorState.ATTACHED));
|
||||
* .setState(WaitForSelectorState.ATTACHED));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> This method does not work across navigations, use {@link Page#waitForSelector Page.waitForSelector()} instead.
|
||||
|
||||
@ -1808,7 +1808,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1833,7 +1833,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1856,7 +1856,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1881,7 +1881,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1904,7 +1904,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1929,7 +1929,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1952,7 +1952,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -1977,7 +1977,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -2000,7 +2000,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -2025,7 +2025,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -2048,7 +2048,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -2073,7 +2073,7 @@ public interface Frame {
|
||||
* // single selection matching the value
|
||||
* frame.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* frame.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -2266,7 +2266,7 @@ public interface Frame {
|
||||
* // Types instantly
|
||||
* frame.type("#mytextarea", "Hello");
|
||||
* // Types slower, like a user
|
||||
* frame.type("#mytextarea", "World", new Frame.TypeOptions().withDelay(100));
|
||||
* frame.type("#mytextarea", "World", new Frame.TypeOptions().setDelay(100));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See <a
|
||||
@ -2285,7 +2285,7 @@ public interface Frame {
|
||||
* // Types instantly
|
||||
* frame.type("#mytextarea", "Hello");
|
||||
* // Types slower, like a user
|
||||
* frame.type("#mytextarea", "World", new Frame.TypeOptions().withDelay(100));
|
||||
* frame.type("#mytextarea", "World", new Frame.TypeOptions().setDelay(100));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See <a
|
||||
|
||||
@ -139,11 +139,11 @@ public interface Keyboard {
|
||||
* Page page = browser.newPage();
|
||||
* page.navigate("https://keycode.info");
|
||||
* page.keyboard().press("A");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("A.png"));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("A.png"));
|
||||
* page.keyboard().press("ArrowLeft");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("ArrowLeft.png")));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("ArrowLeft.png")));
|
||||
* page.keyboard().press("Shift+O");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("O.png")));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("O.png")));
|
||||
* browser.close();
|
||||
* }</pre>
|
||||
*
|
||||
@ -176,11 +176,11 @@ public interface Keyboard {
|
||||
* Page page = browser.newPage();
|
||||
* page.navigate("https://keycode.info");
|
||||
* page.keyboard().press("A");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("A.png"));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("A.png"));
|
||||
* page.keyboard().press("ArrowLeft");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("ArrowLeft.png")));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("ArrowLeft.png")));
|
||||
* page.keyboard().press("Shift+O");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("O.png")));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("O.png")));
|
||||
* browser.close();
|
||||
* }</pre>
|
||||
*
|
||||
@ -197,7 +197,7 @@ public interface Keyboard {
|
||||
* // Types instantly
|
||||
* page.keyboard().type("Hello");
|
||||
* // Types slower, like a user
|
||||
* page.keyboard().type("World", new Keyboard.TypeOptions().withDelay(100));
|
||||
* page.keyboard().type("World", new Keyboard.TypeOptions().setDelay(100));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Modifier keys DO NOT effect {@code keyboard.type}. Holding down {@code Shift} will not type the text in upper case.
|
||||
@ -215,7 +215,7 @@ public interface Keyboard {
|
||||
* // Types instantly
|
||||
* page.keyboard().type("Hello");
|
||||
* // Types slower, like a user
|
||||
* page.keyboard().type("World", new Keyboard.TypeOptions().withDelay(100));
|
||||
* page.keyboard().type("World", new Keyboard.TypeOptions().setDelay(100));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> <strong>NOTE:</strong> Modifier keys DO NOT effect {@code keyboard.type}. Holding down {@code Shift} will not type the text in upper case.
|
||||
|
||||
@ -40,7 +40,7 @@ import java.util.regex.Pattern;
|
||||
* BrowserContext context = browser.newContext();
|
||||
* Page page = context.newPage();
|
||||
* page.navigate("https://example.com");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("screenshot.png")));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("screenshot.png")));
|
||||
* browser.close();
|
||||
* }
|
||||
* }
|
||||
@ -1972,7 +1972,7 @@ public interface Page extends AutoCloseable {
|
||||
* page.evaluate("() => matchMedia('print').matches");
|
||||
* // → false
|
||||
*
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().withMedia(Media.PRINT));
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.PRINT));
|
||||
* page.evaluate("() => matchMedia('screen').matches");
|
||||
* // → false
|
||||
* page.evaluate("() => matchMedia('print').matches");
|
||||
@ -1985,7 +1985,7 @@ public interface Page extends AutoCloseable {
|
||||
* // → false
|
||||
* }</pre>
|
||||
* <pre>{@code
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(ColorScheme.DARK));
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(ColorScheme.DARK));
|
||||
* page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches");
|
||||
* // → true
|
||||
* page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches");
|
||||
@ -2004,7 +2004,7 @@ public interface Page extends AutoCloseable {
|
||||
* page.evaluate("() => matchMedia('print').matches");
|
||||
* // → false
|
||||
*
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().withMedia(Media.PRINT));
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.PRINT));
|
||||
* page.evaluate("() => matchMedia('screen').matches");
|
||||
* // → false
|
||||
* page.evaluate("() => matchMedia('print').matches");
|
||||
@ -2017,7 +2017,7 @@ public interface Page extends AutoCloseable {
|
||||
* // → false
|
||||
* }</pre>
|
||||
* <pre>{@code
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().withColorScheme(ColorScheme.DARK));
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().setColorScheme(ColorScheme.DARK));
|
||||
* page.evaluate("() => matchMedia('(prefers-color-scheme: dark)').matches");
|
||||
* // → true
|
||||
* page.evaluate("() => matchMedia('(prefers-color-scheme: light)').matches");
|
||||
@ -2305,7 +2305,7 @@ public interface Page extends AutoCloseable {
|
||||
* ElementHandle element = (ElementHandle) args[0];
|
||||
* System.out.println(element.textContent());
|
||||
* return null;
|
||||
* }, new Page.ExposeBindingOptions().withHandle(true));
|
||||
* }, new Page.ExposeBindingOptions().setHandle(true));
|
||||
* page.setContent("" +
|
||||
* "<script>\n" +
|
||||
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
|
||||
@ -2366,7 +2366,7 @@ public interface Page extends AutoCloseable {
|
||||
* ElementHandle element = (ElementHandle) args[0];
|
||||
* System.out.println(element.textContent());
|
||||
* return null;
|
||||
* }, new Page.ExposeBindingOptions().withHandle(true));
|
||||
* }, new Page.ExposeBindingOptions().setHandle(true));
|
||||
* page.setContent("" +
|
||||
* "<script>\n" +
|
||||
* " document.addEventListener('click', event => window.clicked(event.target));\n" +
|
||||
@ -2852,8 +2852,8 @@ public interface Page extends AutoCloseable {
|
||||
* property to force rendering of exact colors.
|
||||
* <pre>{@code
|
||||
* // Generates a PDF with "screen" media type.
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().withMedia(Media.SCREEN));
|
||||
* page.pdf(new Page.PdfOptions().withPath(Paths.get("page.pdf")));
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.SCREEN));
|
||||
* page.pdf(new Page.PdfOptions().setPath(Paths.get("page.pdf")));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> The {@code width}, {@code height}, and {@code margin} options accept values labeled with units. Unlabeled values are treated as pixels.
|
||||
@ -2907,8 +2907,8 @@ public interface Page extends AutoCloseable {
|
||||
* property to force rendering of exact colors.
|
||||
* <pre>{@code
|
||||
* // Generates a PDF with "screen" media type.
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().withMedia(Media.SCREEN));
|
||||
* page.pdf(new Page.PdfOptions().withPath(Paths.get("page.pdf")));
|
||||
* page.emulateMedia(new Page.EmulateMediaOptions().setMedia(Media.SCREEN));
|
||||
* page.pdf(new Page.PdfOptions().setPath(Paths.get("page.pdf")));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> The {@code width}, {@code height}, and {@code margin} options accept values labeled with units. Unlabeled values are treated as pixels.
|
||||
@ -2971,11 +2971,11 @@ public interface Page extends AutoCloseable {
|
||||
* Page page = browser.newPage();
|
||||
* page.navigate("https://keycode.info");
|
||||
* page.press("body", "A");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("A.png")));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("A.png")));
|
||||
* page.press("body", "ArrowLeft");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("ArrowLeft.png" )));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("ArrowLeft.png" )));
|
||||
* page.press("body", "Shift+O");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("O.png" )));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("O.png" )));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See <a
|
||||
@ -3009,11 +3009,11 @@ public interface Page extends AutoCloseable {
|
||||
* Page page = browser.newPage();
|
||||
* page.navigate("https://keycode.info");
|
||||
* page.press("body", "A");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("A.png")));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("A.png")));
|
||||
* page.press("body", "ArrowLeft");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("ArrowLeft.png" )));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("ArrowLeft.png" )));
|
||||
* page.press("body", "Shift+O");
|
||||
* page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("O.png" )));
|
||||
* page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("O.png" )));
|
||||
* }</pre>
|
||||
*
|
||||
* @param selector A selector to search for element. If there are multiple elements satisfying the selector, the first will be used. See <a
|
||||
@ -3174,7 +3174,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3201,7 +3201,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3226,7 +3226,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3253,7 +3253,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3278,7 +3278,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3305,7 +3305,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3330,7 +3330,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3357,7 +3357,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3382,7 +3382,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3409,7 +3409,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3434,7 +3434,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3461,7 +3461,7 @@ public interface Page extends AutoCloseable {
|
||||
* // single selection matching the value
|
||||
* page.selectOption("select#colors", "blue");
|
||||
* // single selection matching both the value and the label
|
||||
* page.selectOption("select#colors", new SelectOption().withLabel("Blue"));
|
||||
* page.selectOption("select#colors", new SelectOption().setLabel("Blue"));
|
||||
* // multiple selection
|
||||
* page.selectOption("select#colors", new String[] {"red", "green", "blue"});
|
||||
* }</pre>
|
||||
@ -3711,7 +3711,7 @@ public interface Page extends AutoCloseable {
|
||||
* // Types instantly
|
||||
* page.type("#mytextarea", "Hello");
|
||||
* // Types slower, like a user
|
||||
* page.type("#mytextarea", "World", new Page.TypeOptions().withDelay(100));
|
||||
* page.type("#mytextarea", "World", new Page.TypeOptions().setDelay(100));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> Shortcut for main frame's {@link Frame#type Frame.type()}.
|
||||
@ -3732,7 +3732,7 @@ public interface Page extends AutoCloseable {
|
||||
* // Types instantly
|
||||
* page.type("#mytextarea", "Hello");
|
||||
* // Types slower, like a user
|
||||
* page.type("#mytextarea", "World", new Page.TypeOptions().withDelay(100));
|
||||
* page.type("#mytextarea", "World", new Page.TypeOptions().setDelay(100));
|
||||
* }</pre>
|
||||
*
|
||||
* <p> Shortcut for main frame's {@link Frame#type Frame.type()}.
|
||||
|
||||
@ -154,7 +154,7 @@ public interface Route {
|
||||
* Map<String, String> headers = new HashMap<>(route.request().headers());
|
||||
* headers.put("foo", "bar"); // set "foo" header
|
||||
* headers.remove("origin"); // remove "origin" header
|
||||
* route.resume(new Route.ResumeOptions().withHeaders(headers));
|
||||
* route.resume(new Route.ResumeOptions().setHeaders(headers));
|
||||
* });
|
||||
* }</pre>
|
||||
*/
|
||||
@ -169,7 +169,7 @@ public interface Route {
|
||||
* Map<String, String> headers = new HashMap<>(route.request().headers());
|
||||
* headers.put("foo", "bar"); // set "foo" header
|
||||
* headers.remove("origin"); // remove "origin" header
|
||||
* route.resume(new Route.ResumeOptions().withHeaders(headers));
|
||||
* route.resume(new Route.ResumeOptions().setHeaders(headers));
|
||||
* });
|
||||
* }</pre>
|
||||
*/
|
||||
@ -181,16 +181,16 @@ public interface Route {
|
||||
* <pre>{@code
|
||||
* page.route("**\/*", route -> {
|
||||
* route.fulfill(new Route.FulfillOptions()
|
||||
* .withStatus(404)
|
||||
* .withContentType("text/plain")
|
||||
* .withBody("Not Found!"));
|
||||
* .setStatus(404)
|
||||
* .setContentType("text/plain")
|
||||
* .setBody("Not Found!"));
|
||||
* });
|
||||
* }</pre>
|
||||
*
|
||||
* <p> An example of serving static file:
|
||||
* <pre>{@code
|
||||
* page.route("**\/xhr_endpoint", route -> route.fulfill(
|
||||
* new Route.FulfillOptions().withPath(Paths.get("mock_data.json")));
|
||||
* new Route.FulfillOptions().setPath(Paths.get("mock_data.json")));
|
||||
* }</pre>
|
||||
*/
|
||||
default void fulfill() {
|
||||
@ -203,16 +203,16 @@ public interface Route {
|
||||
* <pre>{@code
|
||||
* page.route("**\/*", route -> {
|
||||
* route.fulfill(new Route.FulfillOptions()
|
||||
* .withStatus(404)
|
||||
* .withContentType("text/plain")
|
||||
* .withBody("Not Found!"));
|
||||
* .setStatus(404)
|
||||
* .setContentType("text/plain")
|
||||
* .setBody("Not Found!"));
|
||||
* });
|
||||
* }</pre>
|
||||
*
|
||||
* <p> An example of serving static file:
|
||||
* <pre>{@code
|
||||
* page.route("**\/xhr_endpoint", route -> route.fulfill(
|
||||
* new Route.FulfillOptions().withPath(Paths.get("mock_data.json")));
|
||||
* new Route.FulfillOptions().setPath(Paths.get("mock_data.json")));
|
||||
* }</pre>
|
||||
*/
|
||||
void fulfill(FulfillOptions options);
|
||||
|
||||
@ -1 +1 @@
|
||||
1.9.1-1614893264000
|
||||
1.9.1-1614983396000
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user