Class FrameImpl

All Implemented Interfaces:
Frame

public class FrameImpl extends ChannelOwner implements Frame
  • Field Details

  • Constructor Details

  • Method Details

    • loadStateFromProtocol

      private static WaitUntilState loadStateFromProtocol(String value)
    • querySelector

      public ElementHandle querySelector(String selector, Frame.QuerySelectorOptions options)
      Description copied from interface: Frame
      Returns the ElementHandle pointing to the frame element.

      NOTE: The use of ElementHandle is discouraged, use Locator objects and web-first assertions instead.

      The method finds an element matching the specified selector within the frame. If no elements match the selector, returns null.

      Specified by:
      querySelector in interface Frame
      Parameters:
      selector - A selector to query for.
    • querySelectorImpl

      ElementHandleImpl querySelectorImpl(String selector, Frame.QuerySelectorOptions options)
    • querySelectorAll

      public List<ElementHandle> querySelectorAll(String selector)
      Description copied from interface: Frame
      Returns the ElementHandles pointing to the frame elements.

      NOTE: The use of ElementHandle is discouraged, use Locator objects instead.

      The method finds all elements matching the specified selector within the frame. If no elements match the selector, returns empty array.

      Specified by:
      querySelectorAll in interface Frame
      Parameters:
      selector - A selector to query for.
    • selectOption

      public List<String> selectOption(String selector, String value, Frame.SelectOptionOptions options)
      Description copied from interface: Frame
      This method waits for an element matching selector, waits for actionability checks, waits until all specified options are present in the <select> element and selects these options.

      If the target element is not a <select> element, this method throws an error. However, if the element is inside the <label> element that has an associated control, the control will be used instead.

      Returns the array of option values that have been successfully selected.

      Triggers a change and input event once all the provided options have been selected.

      **Usage**

      
       // Single selection matching the value or label
       frame.selectOption("select#colors", "blue");
       // single selection matching both the value and the label
       frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
       // multiple selection
       frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
       
      Specified by:
      selectOption in interface Frame
      Parameters:
      selector - A selector to query for.
      value - Options to select. If the <select> has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are matching both values and labels. Option is considered matching if all specified properties match.
    • selectOption

      public List<String> selectOption(String selector, ElementHandle value, Frame.SelectOptionOptions options)
      Description copied from interface: Frame
      This method waits for an element matching selector, waits for actionability checks, waits until all specified options are present in the <select> element and selects these options.

      If the target element is not a <select> element, this method throws an error. However, if the element is inside the <label> element that has an associated control, the control will be used instead.

      Returns the array of option values that have been successfully selected.

      Triggers a change and input event once all the provided options have been selected.

      **Usage**

      
       // Single selection matching the value or label
       frame.selectOption("select#colors", "blue");
       // single selection matching both the value and the label
       frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
       // multiple selection
       frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
       
      Specified by:
      selectOption in interface Frame
      Parameters:
      selector - A selector to query for.
      value - Options to select. If the <select> has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are matching both values and labels. Option is considered matching if all specified properties match.
    • selectOption

      public List<String> selectOption(String selector, String[] values, Frame.SelectOptionOptions options)
      Description copied from interface: Frame
      This method waits for an element matching selector, waits for actionability checks, waits until all specified options are present in the <select> element and selects these options.

      If the target element is not a <select> element, this method throws an error. However, if the element is inside the <label> element that has an associated control, the control will be used instead.

      Returns the array of option values that have been successfully selected.

      Triggers a change and input event once all the provided options have been selected.

      **Usage**

      
       // Single selection matching the value or label
       frame.selectOption("select#colors", "blue");
       // single selection matching both the value and the label
       frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
       // multiple selection
       frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
       
      Specified by:
      selectOption in interface Frame
      Parameters:
      selector - A selector to query for.
      values - Options to select. If the <select> has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are matching both values and labels. Option is considered matching if all specified properties match.
    • selectOption

      public List<String> selectOption(String selector, SelectOption value, Frame.SelectOptionOptions options)
      Description copied from interface: Frame
      This method waits for an element matching selector, waits for actionability checks, waits until all specified options are present in the <select> element and selects these options.

      If the target element is not a <select> element, this method throws an error. However, if the element is inside the <label> element that has an associated control, the control will be used instead.

      Returns the array of option values that have been successfully selected.

      Triggers a change and input event once all the provided options have been selected.

      **Usage**

      
       // Single selection matching the value or label
       frame.selectOption("select#colors", "blue");
       // single selection matching both the value and the label
       frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
       // multiple selection
       frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
       
      Specified by:
      selectOption in interface Frame
      Parameters:
      selector - A selector to query for.
      value - Options to select. If the <select> has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are matching both values and labels. Option is considered matching if all specified properties match.
    • querySelectorAllImpl

      List<ElementHandle> querySelectorAllImpl(String selector)
    • evalOnSelector

      public Object evalOnSelector(String selector, String pageFunction, Object arg, Frame.EvalOnSelectorOptions options)
      Description copied from interface: Frame
      Returns the return value of expression.

      The method finds an element matching the specified selector within the frame and passes it as a first argument to expression. If no elements match the selector, the method throws an error.

      If expression returns a Promise, then Frame.evalOnSelector() would wait for the promise to resolve and return its value.

      **Usage**

      
       String searchValue = (String) frame.evalOnSelector("#search", "el => el.value");
       String preloadHref = (String) frame.evalOnSelector("link[rel=preload]", "el => el.href");
       String html = (String) frame.evalOnSelector(".main-container", "(e, suffix) => e.outerHTML + suffix", "hello");
       
      Specified by:
      evalOnSelector in interface Frame
      Parameters:
      selector - A selector to query for.
      pageFunction - JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is automatically invoked.
      arg - Optional argument to pass to expression.
    • evalOnSelectorImpl

      Object evalOnSelectorImpl(String selector, String pageFunction, Object arg, Frame.EvalOnSelectorOptions options)
    • evalOnSelectorAll

      public Object evalOnSelectorAll(String selector, String pageFunction, Object arg)
      Description copied from interface: Frame
      Returns the return value of expression.

      The method finds all elements matching the specified selector within the frame and passes an array of matched elements as a first argument to expression.

      If expression returns a Promise, then Frame.evalOnSelectorAll() would wait for the promise to resolve and return its value.

      **Usage**

      
       boolean divsCounts = (boolean) page.evalOnSelectorAll("div", "(divs, min) => divs.length >= min", 10);
       
      Specified by:
      evalOnSelectorAll in interface Frame
      Parameters:
      selector - A selector to query for.
      pageFunction - JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is automatically invoked.
      arg - Optional argument to pass to expression.
    • evalOnSelectorAllImpl

      Object evalOnSelectorAllImpl(String selector, String pageFunction, Object arg)
    • addScriptTag

      public ElementHandle addScriptTag(Frame.AddScriptTagOptions options)
      Description copied from interface: Frame
      Returns the added tag when the script's onload fires or when the script content was injected into frame.

      Adds a <script> tag into the page with the desired url or content.

      Specified by:
      addScriptTag in interface Frame
    • addScriptTagImpl

      ElementHandle addScriptTagImpl(Frame.AddScriptTagOptions options)
    • addStyleTag

      public ElementHandle addStyleTag(Frame.AddStyleTagOptions options)
      Description copied from interface: Frame
      Returns the added tag when the stylesheet's onload fires or when the CSS content was injected into frame.

      Adds a <link rel="stylesheet"> tag into the page with the desired url or a <style type="text/css"> tag with the content.

      Specified by:
      addStyleTag in interface Frame
    • addStyleTagImpl

      ElementHandle addStyleTagImpl(Frame.AddStyleTagOptions options)
    • check

      public void check(String selector, Frame.CheckOptions options)
      Description copied from interface: Frame
      This method checks an element matching selector by performing the following steps:
      1. Find an element matching selector. If there is none, wait until a matching element is attached to the DOM.
      2. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already checked, this method returns immediately.
      3. Wait for actionability checks on the matched element, unless force option is set. If the element is detached during the checks, the whole action is retried.
      4. Scroll the element into view if needed.
      5. Use Page.mouse() to click in the center of the element.
      6. Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.
      7. Ensure that the element is now checked. If not, this method throws.

      When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.

      Specified by:
      check in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • checkImpl

      void checkImpl(String selector, Frame.CheckOptions options)
    • childFrames

      public List<Frame> childFrames()
      Specified by:
      childFrames in interface Frame
    • click

      public void click(String selector, Frame.ClickOptions options)
      Description copied from interface: Frame
      This method clicks an element matching selector by performing the following steps:
      1. Find an element matching selector. If there is none, wait until a matching element is attached to the DOM.
      2. Wait for actionability checks on the matched element, unless force option is set. If the element is detached during the checks, the whole action is retried.
      3. Scroll the element into view if needed.
      4. Use Page.mouse() to click in the center of the element, or the specified position.
      5. Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.

      When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.

      Specified by:
      click in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • clickImpl

      void clickImpl(String selector, Frame.ClickOptions options)
    • content

      public String content()
      Description copied from interface: Frame
      Gets the full HTML contents of the frame, including the doctype.
      Specified by:
      content in interface Frame
    • contentImpl

      String contentImpl()
    • dblclick

      public void dblclick(String selector, Frame.DblclickOptions options)
      Description copied from interface: Frame
      This method double clicks an element matching selector by performing the following steps:
      1. Find an element matching selector. If there is none, wait until a matching element is attached to the DOM.
      2. Wait for actionability checks on the matched element, unless force option is set. If the element is detached during the checks, the whole action is retried.
      3. Scroll the element into view if needed.
      4. Use Page.mouse() to double click in the center of the element, or the specified position.
      5. Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set. Note that if the first click of the dblclick() triggers a navigation event, this method will throw.

      When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.

      NOTE: frame.dblclick() dispatches two click events and a single dblclick event.

      Specified by:
      dblclick in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • dblclickImpl

      void dblclickImpl(String selector, Frame.DblclickOptions options)
    • dispatchEvent

      public void dispatchEvent(String selector, String type, Object eventInit, Frame.DispatchEventOptions options)
      Description copied from interface: Frame
      The snippet below dispatches the click event on the element. Regardless of the visibility state of the element, click is dispatched. This is equivalent to calling element.click().

      **Usage**

      
       frame.dispatchEvent("button#submit", "click");
       

      Under the hood, it creates an instance of an event based on the given type, initializes it with eventInit properties and dispatches it on the element. Events are composed, cancelable and bubble by default.

      Since eventInit is event-specific, please refer to the events documentation for the lists of initial properties:

      You can also specify JSHandle as the property value if you want live objects to be passed into the event:

      
       // Note you can only create DataTransfer in Chromium and Firefox
       JSHandle dataTransfer = frame.evaluateHandle("() => new DataTransfer()");
       Map<String, Object> arg = new HashMap<>();
       arg.put("dataTransfer", dataTransfer);
       frame.dispatchEvent("#source", "dragstart", arg);
       
      Specified by:
      dispatchEvent in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
      type - DOM event type: "click", "dragstart", etc.
      eventInit - Optional event-specific initialization properties.
    • dispatchEventImpl

      void dispatchEventImpl(String selector, String type, Object eventInit, Frame.DispatchEventOptions options)
    • evaluate

      public Object evaluate(String expression, Object arg)
      Description copied from interface: Frame
      Returns the return value of expression.

      If the function passed to the Frame.evaluate() returns a Promise, then Frame.evaluate() would wait for the promise to resolve and return its value.

      If the function passed to the Frame.evaluate() returns a non-[Serializable] value, then Frame.evaluate() returns undefined. Playwright also supports transferring some additional values that are not serializable by JSON: -0, NaN, Infinity, -Infinity.

      **Usage**

      
       Object result = frame.evaluate("([x, y]) => {\n" +
         "  return Promise.resolve(x * y);\n" +
         "}", Arrays.asList(7, 8));
       System.out.println(result); // prints "56"
       

      A string can also be passed in instead of a function.

      
       System.out.println(frame.evaluate("1 + 2")); // prints "3"
       

      ElementHandle instances can be passed as an argument to the Frame.evaluate():

      
       ElementHandle bodyHandle = frame.evaluate("document.body");
       String html = (String) frame.evaluate("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(bodyHandle, "hello"));
       bodyHandle.dispose();
       
      Specified by:
      evaluate in interface Frame
      Parameters:
      expression - JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is automatically invoked.
      arg - Optional argument to pass to expression.
    • evaluateImpl

      Object evaluateImpl(String expression, Object arg)
    • evaluateHandle

      public JSHandle evaluateHandle(String pageFunction, Object arg)
      Description copied from interface: Frame
      Returns the return value of expression as a JSHandle.

      The only difference between Frame.evaluate() and Frame.evaluateHandle() is that Frame.evaluateHandle() returns JSHandle.

      If the function, passed to the Frame.evaluateHandle(), returns a Promise, then Frame.evaluateHandle() would wait for the promise to resolve and return its value.

      **Usage**

      
       // Handle for the window object.
       JSHandle aWindowHandle = frame.evaluateHandle("() => Promise.resolve(window)");
       

      A string can also be passed in instead of a function.

      
       JSHandle aHandle = frame.evaluateHandle("document"); // Handle for the "document".
       

      JSHandle instances can be passed as an argument to the Frame.evaluateHandle():

      
       JSHandle aHandle = frame.evaluateHandle("() => document.body");
       JSHandle resultHandle = frame.evaluateHandle("([body, suffix]) => body.innerHTML + suffix", Arrays.asList(aHandle, "hello"));
       System.out.println(resultHandle.jsonValue());
       resultHandle.dispose();
       
      Specified by:
      evaluateHandle in interface Frame
      Parameters:
      pageFunction - JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is automatically invoked.
      arg - Optional argument to pass to expression.
    • evaluateHandleImpl

      JSHandle evaluateHandleImpl(String pageFunction, Object arg)
    • fill

      public void fill(String selector, String value, Frame.FillOptions options)
      Description copied from interface: Frame
      This method waits for an element matching selector, waits for actionability checks, focuses the element, fills it and triggers an input event after filling. Note that you can pass an empty string to clear the input field.

      If the target element is not an <input>, <textarea> or [contenteditable] element, this method throws an error. However, if the element is inside the <label> element that has an associated control, the control will be filled instead.

      To send fine-grained keyboard events, use Locator.pressSequentially().

      Specified by:
      fill in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
      value - Value to fill for the <input>, <textarea> or [contenteditable] element.
    • fillImpl

      void fillImpl(String selector, String value, Frame.FillOptions options)
    • focus

      public void focus(String selector, Frame.FocusOptions options)
      Description copied from interface: Frame
      This method fetches an element with selector and focuses it. If there's no element matching selector, the method waits until a matching element appears in the DOM.
      Specified by:
      focus in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • focusImpl

      void focusImpl(String selector, Frame.FocusOptions options)
    • frameElement

      public ElementHandle frameElement()
      Description copied from interface: Frame
      Returns the frame or iframe element handle which corresponds to this frame.

      This is an inverse of ElementHandle.contentFrame(). Note that returned handle actually belongs to the parent frame.

      This method throws an error if the frame has been detached before frameElement() returns.

      **Usage**

      
       ElementHandle frameElement = frame.frameElement();
       Frame contentFrame = frameElement.contentFrame();
       System.out.println(frame == contentFrame);  // -> true
       
      Specified by:
      frameElement in interface Frame
    • frameLocator

      public FrameLocator frameLocator(String selector)
      Description copied from interface: Frame
      When working with iframes, you can create a frame locator that will enter the iframe and allow selecting elements in that iframe.

      **Usage**

      Following snippet locates element with text "Submit" in the iframe with id my-frame, like <iframe id="my-frame">:

      
       Locator locator = frame.frameLocator("#my-iframe").getByText("Submit");
       locator.click();
       
      Specified by:
      frameLocator in interface Frame
      Parameters:
      selector - A selector to use when resolving DOM element.
    • frameElementImpl

      ElementHandle frameElementImpl()
    • getAttribute

      public String getAttribute(String selector, String name, Frame.GetAttributeOptions options)
      Description copied from interface: Frame
      Returns element attribute value.
      Specified by:
      getAttribute in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
      name - Attribute name to get the value for.
    • getByAltText

      public Locator getByAltText(String text, Frame.GetByAltTextOptions options)
      Description copied from interface: Frame
      Allows locating elements by their alt text.

      **Usage**

      For example, this method will find the image by alt text "Playwright logo":

      
       page.getByAltText("Playwright logo").click();
       
      Specified by:
      getByAltText in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByAltText

      public Locator getByAltText(Pattern text, Frame.GetByAltTextOptions options)
      Description copied from interface: Frame
      Allows locating elements by their alt text.

      **Usage**

      For example, this method will find the image by alt text "Playwright logo":

      
       page.getByAltText("Playwright logo").click();
       
      Specified by:
      getByAltText in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByLabel

      public Locator getByLabel(String text, Frame.GetByLabelOptions options)
      Description copied from interface: Frame
      Allows locating input elements by the text of the associated <label> or aria-labelledby element, or by the aria-label attribute.

      **Usage**

      For example, this method will find inputs by label "Username" and "Password" in the following DOM:

      
       page.getByLabel("Username").fill("john");
       page.getByLabel("Password").fill("secret");
       
      Specified by:
      getByLabel in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByLabel

      public Locator getByLabel(Pattern text, Frame.GetByLabelOptions options)
      Description copied from interface: Frame
      Allows locating input elements by the text of the associated <label> or aria-labelledby element, or by the aria-label attribute.

      **Usage**

      For example, this method will find inputs by label "Username" and "Password" in the following DOM:

      
       page.getByLabel("Username").fill("john");
       page.getByLabel("Password").fill("secret");
       
      Specified by:
      getByLabel in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByPlaceholder

      public Locator getByPlaceholder(String text, Frame.GetByPlaceholderOptions options)
      Description copied from interface: Frame
      Allows locating input elements by the placeholder text.

      **Usage**

      For example, consider the following DOM structure.

      You can fill the input after locating it by the placeholder text:

      
       page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
       
      Specified by:
      getByPlaceholder in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByPlaceholder

      public Locator getByPlaceholder(Pattern text, Frame.GetByPlaceholderOptions options)
      Description copied from interface: Frame
      Allows locating input elements by the placeholder text.

      **Usage**

      For example, consider the following DOM structure.

      You can fill the input after locating it by the placeholder text:

      
       page.getByPlaceholder("name@example.com").fill("playwright@microsoft.com");
       
      Specified by:
      getByPlaceholder in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByRole

      public Locator getByRole(AriaRole role, Frame.GetByRoleOptions options)
      Description copied from interface: Frame
      Allows locating elements by their ARIA role, ARIA attributes and accessible name.

      **Usage**

      Consider the following DOM structure.

      You can locate each element by it's implicit role:

      
       assertThat(page
           .getByRole(AriaRole.HEADING,
                      new Page.GetByRoleOptions().setName("Sign up")))
           .isVisible();
      
       page.getByRole(AriaRole.CHECKBOX,
                      new Page.GetByRoleOptions().setName("Subscribe"))
           .check();
      
       page.getByRole(AriaRole.BUTTON,
                      new Page.GetByRoleOptions().setName(
                          Pattern.compile("submit", Pattern.CASE_INSENSITIVE)))
           .click();
       

      **Details**

      Role selector **does not replace** accessibility audits and conformance tests, but rather gives early feedback about the ARIA guidelines.

      Many html elements have an implicitly defined role that is recognized by the role selector. You can find all the supported roles here. ARIA guidelines **do not recommend** duplicating implicit roles and attributes by setting role and/or aria-* attributes to default values.

      Specified by:
      getByRole in interface Frame
      Parameters:
      role - Required aria role.
    • getByTestId

      public Locator getByTestId(String testId)
      Description copied from interface: Frame
      Locate element by the test id.

      **Usage**

      Consider the following DOM structure.

      You can locate the element by it's test id:

      
       page.getByTestId("directions").click();
       

      **Details**

      By default, the data-testid attribute is used as a test id. Use Selectors.setTestIdAttribute() to configure a different test id attribute if necessary.

      Specified by:
      getByTestId in interface Frame
      Parameters:
      testId - Id to locate the element by.
    • getByTestId

      public Locator getByTestId(Pattern testId)
      Description copied from interface: Frame
      Locate element by the test id.

      **Usage**

      Consider the following DOM structure.

      You can locate the element by it's test id:

      
       page.getByTestId("directions").click();
       

      **Details**

      By default, the data-testid attribute is used as a test id. Use Selectors.setTestIdAttribute() to configure a different test id attribute if necessary.

      Specified by:
      getByTestId in interface Frame
      Parameters:
      testId - Id to locate the element by.
    • getByText

      public Locator getByText(String text, Frame.GetByTextOptions options)
      Description copied from interface: Frame
      Allows locating elements that contain given text.

      See also Locator.filter() that allows to match by another criteria, like an accessible role, and then filter by the text content.

      **Usage**

      Consider the following DOM structure:

      You can locate by text substring, exact string, or a regular expression:

      
       // Matches <span>
       page.getByText("world")
      
       // Matches first <div>
       page.getByText("Hello world")
      
       // Matches second <div>
       page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
      
       // Matches both <div>s
       page.getByText(Pattern.compile("Hello"))
      
       // Matches second <div>
       page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
       

      **Details**

      Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one, turns line breaks into spaces and ignores leading and trailing whitespace.

      Input elements of the type button and submit are matched by their value instead of the text content. For example, locating by text "Log in" matches <input type=button value="Log in">.

      Specified by:
      getByText in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByText

      public Locator getByText(Pattern text, Frame.GetByTextOptions options)
      Description copied from interface: Frame
      Allows locating elements that contain given text.

      See also Locator.filter() that allows to match by another criteria, like an accessible role, and then filter by the text content.

      **Usage**

      Consider the following DOM structure:

      You can locate by text substring, exact string, or a regular expression:

      
       // Matches <span>
       page.getByText("world")
      
       // Matches first <div>
       page.getByText("Hello world")
      
       // Matches second <div>
       page.getByText("Hello", new Page.GetByTextOptions().setExact(true))
      
       // Matches both <div>s
       page.getByText(Pattern.compile("Hello"))
      
       // Matches second <div>
       page.getByText(Pattern.compile("^hello$", Pattern.CASE_INSENSITIVE))
       

      **Details**

      Matching by text always normalizes whitespace, even with exact match. For example, it turns multiple spaces into one, turns line breaks into spaces and ignores leading and trailing whitespace.

      Input elements of the type button and submit are matched by their value instead of the text content. For example, locating by text "Log in" matches <input type=button value="Log in">.

      Specified by:
      getByText in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByTitle

      public Locator getByTitle(String text, Frame.GetByTitleOptions options)
      Description copied from interface: Frame
      Allows locating elements by their title attribute.

      **Usage**

      Consider the following DOM structure.

      You can check the issues count after locating it by the title text:

      
       assertThat(page.getByTitle("Issues count")).hasText("25 issues");
       
      Specified by:
      getByTitle in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getByTitle

      public Locator getByTitle(Pattern text, Frame.GetByTitleOptions options)
      Description copied from interface: Frame
      Allows locating elements by their title attribute.

      **Usage**

      Consider the following DOM structure.

      You can check the issues count after locating it by the title text:

      
       assertThat(page.getByTitle("Issues count")).hasText("25 issues");
       
      Specified by:
      getByTitle in interface Frame
      Parameters:
      text - Text to locate the element for.
    • getAttributeImpl

      String getAttributeImpl(String selector, String name, Frame.GetAttributeOptions options)
    • hover

      public void hover(String selector, Frame.HoverOptions options)
      Description copied from interface: Frame
      This method hovers over an element matching selector by performing the following steps:
      1. Find an element matching selector. If there is none, wait until a matching element is attached to the DOM.
      2. Wait for actionability checks on the matched element, unless force option is set. If the element is detached during the checks, the whole action is retried.
      3. Scroll the element into view if needed.
      4. Use Page.mouse() to hover over the center of the element, or the specified position.
      5. Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.

      When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.

      Specified by:
      hover in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • hoverImpl

      void hoverImpl(String selector, Frame.HoverOptions options)
    • dragAndDrop

      public void dragAndDrop(String source, String target, Frame.DragAndDropOptions options)
      Specified by:
      dragAndDrop in interface Frame
      Parameters:
      source - A selector to search for an element to drag. If there are multiple elements satisfying the selector, the first will be used.
      target - A selector to search for an element to drop onto. If there are multiple elements satisfying the selector, the first will be used.
    • dragAndDropImpl

      void dragAndDropImpl(String source, String target, Frame.DragAndDropOptions options)
    • innerHTML

      public String innerHTML(String selector, Frame.InnerHTMLOptions options)
      Description copied from interface: Frame
      Returns element.innerHTML.
      Specified by:
      innerHTML in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • innerHTMLImpl

      String innerHTMLImpl(String selector, Frame.InnerHTMLOptions options)
    • innerText

      public String innerText(String selector, Frame.InnerTextOptions options)
      Description copied from interface: Frame
      Returns element.innerText.
      Specified by:
      innerText in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • innerTextImpl

      String innerTextImpl(String selector, Frame.InnerTextOptions options)
    • inputValue

      public String inputValue(String selector, Frame.InputValueOptions options)
      Description copied from interface: Frame
      Returns input.value for the selected <input> or <textarea> or <select> element.

      Throws for non-input elements. However, if the element is inside the <label> element that has an associated control, returns the value of the control.

      Specified by:
      inputValue in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • inputValueImpl

      String inputValueImpl(String selector, Frame.InputValueOptions options)
    • isChecked

      public boolean isChecked(String selector, Frame.IsCheckedOptions options)
      Description copied from interface: Frame
      Returns whether the element is checked. Throws if the element is not a checkbox or radio input.
      Specified by:
      isChecked in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • isCheckedImpl

      boolean isCheckedImpl(String selector, Frame.IsCheckedOptions options)
    • isDetached

      public boolean isDetached()
      Description copied from interface: Frame
      Returns true if the frame has been detached, or false otherwise.
      Specified by:
      isDetached in interface Frame
    • isDisabled

      public boolean isDisabled(String selector, Frame.IsDisabledOptions options)
      Description copied from interface: Frame
      Returns whether the element is disabled, the opposite of enabled.
      Specified by:
      isDisabled in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • isDisabledImpl

      boolean isDisabledImpl(String selector, Frame.IsDisabledOptions options)
    • isEditable

      public boolean isEditable(String selector, Frame.IsEditableOptions options)
      Description copied from interface: Frame
      Returns whether the element is editable.
      Specified by:
      isEditable in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • isEditableImpl

      boolean isEditableImpl(String selector, Frame.IsEditableOptions options)
    • isEnabled

      public boolean isEnabled(String selector, Frame.IsEnabledOptions options)
      Description copied from interface: Frame
      Returns whether the element is enabled.
      Specified by:
      isEnabled in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • isEnabledImpl

      boolean isEnabledImpl(String selector, Frame.IsEnabledOptions options)
    • isHidden

      public boolean isHidden(String selector, Frame.IsHiddenOptions options)
      Description copied from interface: Frame
      Returns whether the element is hidden, the opposite of visible. selector that does not match any elements is considered hidden.
      Specified by:
      isHidden in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • isHiddenImpl

      boolean isHiddenImpl(String selector, Frame.IsHiddenOptions options)
    • isVisible

      public boolean isVisible(String selector, Frame.IsVisibleOptions options)
      Description copied from interface: Frame
      Returns whether the element is visible. selector that does not match any elements is considered not visible.
      Specified by:
      isVisible in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • locator

      public Locator locator(String selector, Frame.LocatorOptions options)
      Description copied from interface: Frame
      The method returns an element locator that can be used to perform actions on this page / frame. Locator is resolved to the element immediately before performing an action, so a series of actions on the same locator can in fact be performed on different DOM elements. That would happen if the DOM structure between those actions has changed.

      Learn more about locators.

      Learn more about locators.

      Specified by:
      locator in interface Frame
      Parameters:
      selector - A selector to use when resolving DOM element.
    • isVisibleImpl

      boolean isVisibleImpl(String selector, Frame.IsVisibleOptions options)
    • name

      public String name()
      Description copied from interface: Frame
      Returns frame's name attribute as specified in the tag.

      If the name is empty, returns the id attribute instead.

      NOTE: This value is calculated once when the frame is created, and will not update if the attribute is changed later.

      Specified by:
      name in interface Frame
    • page

      public PageImpl page()
      Description copied from interface: Frame
      Returns the page containing this frame.
      Specified by:
      page in interface Frame
    • parentFrame

      public Frame parentFrame()
      Description copied from interface: Frame
      Parent frame, if any. Detached frames and main frames return null.
      Specified by:
      parentFrame in interface Frame
    • press

      public void press(String selector, String key, Frame.PressOptions options)
      Description copied from interface: Frame
      key can specify the intended keyboardEvent.key value or a single character to generate the text for. A superset of the key values can be found here. Examples of the keys are:

      F1 - F12, Digit0- Digit9, KeyA- KeyZ, Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape, ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight, ArrowUp, etc.

      Following modification shortcuts are also supported: Shift, Control, Alt, Meta, ShiftLeft.

      Holding down Shift will type the text that corresponds to the key in the upper case.

      If key is a single character, it is case-sensitive, so the values a and A will generate different respective texts.

      Shortcuts such as key: "Control+o" or key: "Control+Shift+T" are supported as well. When specified with the modifier, modifier is pressed and being held while the subsequent key is being pressed.

      Specified by:
      press in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
      key - Name of the key to press or a character to generate, such as ArrowLeft or a.
    • pressImpl

      void pressImpl(String selector, String key, Frame.PressOptions options)
    • selectOption

      public List<String> selectOption(String selector, SelectOption[] values, Frame.SelectOptionOptions options)
      Description copied from interface: Frame
      This method waits for an element matching selector, waits for actionability checks, waits until all specified options are present in the <select> element and selects these options.

      If the target element is not a <select> element, this method throws an error. However, if the element is inside the <label> element that has an associated control, the control will be used instead.

      Returns the array of option values that have been successfully selected.

      Triggers a change and input event once all the provided options have been selected.

      **Usage**

      
       // Single selection matching the value or label
       frame.selectOption("select#colors", "blue");
       // single selection matching both the value and the label
       frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
       // multiple selection
       frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
       
      Specified by:
      selectOption in interface Frame
      Parameters:
      selector - A selector to query for.
      values - Options to select. If the <select> has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are matching both values and labels. Option is considered matching if all specified properties match.
    • selectOptionImpl

      List<String> selectOptionImpl(String selector, SelectOption[] values, Frame.SelectOptionOptions options)
    • selectOptionImpl

      List<String> selectOptionImpl(String selector, String[] values, Frame.SelectOptionOptions options)
    • selectOption

      public List<String> selectOption(String selector, ElementHandle[] values, Frame.SelectOptionOptions options)
      Description copied from interface: Frame
      This method waits for an element matching selector, waits for actionability checks, waits until all specified options are present in the <select> element and selects these options.

      If the target element is not a <select> element, this method throws an error. However, if the element is inside the <label> element that has an associated control, the control will be used instead.

      Returns the array of option values that have been successfully selected.

      Triggers a change and input event once all the provided options have been selected.

      **Usage**

      
       // Single selection matching the value or label
       frame.selectOption("select#colors", "blue");
       // single selection matching both the value and the label
       frame.selectOption("select#colors", new SelectOption().setLabel("Blue"));
       // multiple selection
       frame.selectOption("select#colors", new String[] {"red", "green", "blue"});
       
      Specified by:
      selectOption in interface Frame
      Parameters:
      selector - A selector to query for.
      values - Options to select. If the <select> has the multiple attribute, all matching options are selected, otherwise only the first option matching one of the passed options is selected. String values are matching both values and labels. Option is considered matching if all specified properties match.
    • selectOptionImpl

      List<String> selectOptionImpl(String selector, ElementHandle[] values, Frame.SelectOptionOptions options)
    • selectOption

      private List<String> selectOption(com.google.gson.JsonObject params)
    • setChecked

      public void setChecked(String selector, boolean checked, Frame.SetCheckedOptions options)
      Description copied from interface: Frame
      This method checks or unchecks an element matching selector by performing the following steps:
      1. Find an element matching selector. If there is none, wait until a matching element is attached to the DOM.
      2. Ensure that matched element is a checkbox or a radio input. If not, this method throws.
      3. If the element already has the right checked state, this method returns immediately.
      4. Wait for actionability checks on the matched element, unless force option is set. If the element is detached during the checks, the whole action is retried.
      5. Scroll the element into view if needed.
      6. Use Page.mouse() to click in the center of the element.
      7. Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.
      8. Ensure that the element is now checked or unchecked. If not, this method throws.

      When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.

      Specified by:
      setChecked in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
      checked - Whether to check or uncheck the checkbox.
    • setCheckedImpl

      void setCheckedImpl(String selector, boolean checked, Frame.SetCheckedOptions options)
    • setContent

      public void setContent(String html, Frame.SetContentOptions options)
      Description copied from interface: Frame
      This method internally calls document.write(), inheriting all its specific characteristics and behaviors.
      Specified by:
      setContent in interface Frame
      Parameters:
      html - HTML markup to assign to the page.
    • setInputFiles

      public void setInputFiles(String selector, Path files, Frame.SetInputFilesOptions options)
      Description copied from interface: Frame
      Sets the value of the file input to these file paths or files. If some of the filePaths are relative paths, then they are resolved relative to the current working directory. For empty array, clears the selected files.

      This method expects selector to point to an input element. However, if the element is inside the <label> element that has an associated control, targets the control instead.

      Specified by:
      setInputFiles in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • setContentImpl

      void setContentImpl(String html, Frame.SetContentOptions options)
    • setInputFiles

      public void setInputFiles(String selector, Path[] files, Frame.SetInputFilesOptions options)
      Description copied from interface: Frame
      Sets the value of the file input to these file paths or files. If some of the filePaths are relative paths, then they are resolved relative to the current working directory. For empty array, clears the selected files.

      This method expects selector to point to an input element. However, if the element is inside the <label> element that has an associated control, targets the control instead.

      Specified by:
      setInputFiles in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • setInputFilesImpl

      void setInputFilesImpl(String selector, Path[] files, Frame.SetInputFilesOptions options)
    • setInputFiles

      public void setInputFiles(String selector, FilePayload files, Frame.SetInputFilesOptions options)
      Description copied from interface: Frame
      Sets the value of the file input to these file paths or files. If some of the filePaths are relative paths, then they are resolved relative to the current working directory. For empty array, clears the selected files.

      This method expects selector to point to an input element. However, if the element is inside the <label> element that has an associated control, targets the control instead.

      Specified by:
      setInputFiles in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • setInputFiles

      public void setInputFiles(String selector, FilePayload[] files, Frame.SetInputFilesOptions options)
      Description copied from interface: Frame
      Sets the value of the file input to these file paths or files. If some of the filePaths are relative paths, then they are resolved relative to the current working directory. For empty array, clears the selected files.

      This method expects selector to point to an input element. However, if the element is inside the <label> element that has an associated control, targets the control instead.

      Specified by:
      setInputFiles in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • setInputFilesImpl

      void setInputFilesImpl(String selector, FilePayload[] files, Frame.SetInputFilesOptions options)
    • tap

      public void tap(String selector, Frame.TapOptions options)
      Description copied from interface: Frame
      This method taps an element matching selector by performing the following steps:
      1. Find an element matching selector. If there is none, wait until a matching element is attached to the DOM.
      2. Wait for actionability checks on the matched element, unless force option is set. If the element is detached during the checks, the whole action is retried.
      3. Scroll the element into view if needed.
      4. Use Page.touchscreen() to tap the center of the element, or the specified position.
      5. Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.

      When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.

      NOTE: frame.tap() requires that the hasTouch option of the browser context be set to true.

      Specified by:
      tap in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • tapImpl

      void tapImpl(String selector, Frame.TapOptions options)
    • textContent

      public String textContent(String selector, Frame.TextContentOptions options)
      Description copied from interface: Frame
      Returns element.textContent.
      Specified by:
      textContent in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • textContentImpl

      String textContentImpl(String selector, Frame.TextContentOptions options)
    • title

      public String title()
      Description copied from interface: Frame
      Returns the page title.
      Specified by:
      title in interface Frame
    • titleImpl

      String titleImpl()
    • type

      public void type(String selector, String text, Frame.TypeOptions options)
      Specified by:
      type in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
      text - A text to type into a focused element.
    • typeImpl

      void typeImpl(String selector, String text, Frame.TypeOptions options)
    • uncheck

      public void uncheck(String selector, Frame.UncheckOptions options)
      Description copied from interface: Frame
      This method checks an element matching selector by performing the following steps:
      1. Find an element matching selector. If there is none, wait until a matching element is attached to the DOM.
      2. Ensure that matched element is a checkbox or a radio input. If not, this method throws. If the element is already unchecked, this method returns immediately.
      3. Wait for actionability checks on the matched element, unless force option is set. If the element is detached during the checks, the whole action is retried.
      4. Scroll the element into view if needed.
      5. Use Page.mouse() to click in the center of the element.
      6. Wait for initiated navigations to either succeed or fail, unless noWaitAfter option is set.
      7. Ensure that the element is now unchecked. If not, this method throws.

      When all steps combined have not finished during the specified timeout, this method throws a TimeoutError. Passing zero timeout disables this.

      Specified by:
      uncheck in interface Frame
      Parameters:
      selector - A selector to search for an element. If there are multiple elements satisfying the selector, the first will be used.
    • uncheckImpl

      void uncheckImpl(String selector, Frame.UncheckOptions options)
    • url

      public String url()
      Description copied from interface: Frame
      Returns frame's url.
      Specified by:
      url in interface Frame
    • waitForFunction

      public JSHandle waitForFunction(String pageFunction, Object arg, Frame.WaitForFunctionOptions options)
      Description copied from interface: Frame
      Returns when the expression returns a truthy value, returns that value.

      **Usage**

      The Frame.waitForFunction() can be used to observe viewport size change:

      
       import com.microsoft.playwright.*;
      
       public class Example {
         public static void main(String[] args) {
           try (Playwright playwright = Playwright.create()) {
             BrowserType firefox = playwright.firefox();
             Browser browser = firefox.launch();
             Page page = browser.newPage();
             page.setViewportSize(50, 50);
             page.mainFrame().waitForFunction("window.innerWidth < 100");
             browser.close();
           }
         }
       }
       

      To pass an argument to the predicate of frame.waitForFunction function:

      
       String selector = ".foo";
       frame.waitForFunction("selector => !!document.querySelector(selector)", selector);
       
      Specified by:
      waitForFunction in interface Frame
      Parameters:
      pageFunction - JavaScript expression to be evaluated in the browser context. If the expression evaluates to a function, the function is automatically invoked.
      arg - Optional argument to pass to expression.
    • waitForFunctionImpl

      JSHandle waitForFunctionImpl(String pageFunction, Object arg, Frame.WaitForFunctionOptions options)
    • waitForLoadState

      public void waitForLoadState(LoadState state, Frame.WaitForLoadStateOptions options)
      Description copied from interface: Frame
      Waits for the required load state to be reached.

      This returns when the frame reaches a required load state, load by default. The navigation must have been committed when this method is called. If current document has already reached the required state, resolves immediately.

      **Usage**

      
       frame.click("button"); // Click triggers navigation.
       frame.waitForLoadState(); // Waits for "load" state by default.
       
      Specified by:
      waitForLoadState in interface Frame
      Parameters:
      state - Optional load state to wait for, defaults to load. If the state has been already reached while loading current document, the method resolves immediately. Can be one of:
      • "load" - wait for the load event to be fired.
      • "domcontentloaded" - wait for the DOMContentLoaded event to be fired.
      • "networkidle" - **DISCOURAGED** wait until there are no network connections for at least 500 ms. Don't use this method for testing, rely on web assertions to assess readiness instead.
    • waitForLoadStateImpl

      void waitForLoadStateImpl(LoadState state, Frame.WaitForLoadStateOptions options, Logger logger)
    • waitForLoadStateImpl

      private void waitForLoadStateImpl(WaitUntilState state, Frame.WaitForLoadStateOptions options, Logger logger)
    • waitForNavigation

      public Response waitForNavigation(Frame.WaitForNavigationOptions options, Runnable code)
      Specified by:
      waitForNavigation in interface Frame
      Parameters:
      code - Callback that performs the action triggering the event.
    • waitForNavigationImpl

      Response waitForNavigationImpl(Logger logger, Runnable code, Frame.WaitForNavigationOptions options)
    • waitForNavigationImpl

      private Response waitForNavigationImpl(Logger logger, Runnable code, Frame.WaitForNavigationOptions options, UrlMatcher matcher)
    • waitForSelector

      public ElementHandle waitForSelector(String selector, Frame.WaitForSelectorOptions options)
      Description copied from interface: Frame
      Returns when element specified by selector satisfies state option. Returns null if waiting for hidden or detached.

      NOTE: Playwright automatically waits for element to be ready before performing an action. Using Locator objects and web-first assertions make the code wait-for-selector-free.

      Wait for the selector to satisfy state option (either appear/disappear from dom, or become visible/hidden). If at the moment of calling the method selector already satisfies the condition, the method will return immediately. If the selector doesn't satisfy the condition for the timeout milliseconds, the function will throw.

      **Usage**

      This method works across navigations:

      
       import com.microsoft.playwright.*;
      
       public class Example {
         public static void main(String[] args) {
           try (Playwright playwright = Playwright.create()) {
             BrowserType chromium = playwright.chromium();
             Browser browser = chromium.launch();
             Page page = browser.newPage();
             for (String currentURL : Arrays.asList("https://google.com", "https://bbc.com")) {
               page.navigate(currentURL);
               ElementHandle element = page.mainFrame().waitForSelector("img");
               System.out.println("Loaded image: " + element.getAttribute("src"));
             }
             browser.close();
           }
         }
       }
       
      Specified by:
      waitForSelector in interface Frame
      Parameters:
      selector - A selector to query for.
    • waitForSelectorImpl

      ElementHandle waitForSelectorImpl(String selector, Frame.WaitForSelectorOptions options)
    • waitForSelectorImpl

      ElementHandle waitForSelectorImpl(String selector, Frame.WaitForSelectorOptions options, boolean omitReturnValue)
    • waitForTimeout

      public void waitForTimeout(double timeout)
      Description copied from interface: Frame
      Waits for the given timeout in milliseconds.

      Note that frame.waitForTimeout() should only be used for debugging. Tests using the timer in production are going to be flaky. Use signals such as network events, selectors becoming visible and others instead.

      Specified by:
      waitForTimeout in interface Frame
      Parameters:
      timeout - A timeout to wait for
    • waitForTimeoutImpl

      void waitForTimeoutImpl(double timeout)
    • waitForURL

      public void waitForURL(String url, Frame.WaitForURLOptions options)
      Description copied from interface: Frame
      Waits for the frame to navigate to the given URL.

      **Usage**

      
       frame.click("a.delayed-navigation"); // Clicking the link will indirectly cause a navigation
       frame.waitForURL("**\/target.html");
       
      Specified by:
      waitForURL in interface Frame
      Parameters:
      url - A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly equal to the string.
    • waitForURL

      public void waitForURL(Pattern url, Frame.WaitForURLOptions options)
      Description copied from interface: Frame
      Waits for the frame to navigate to the given URL.

      **Usage**

      
       frame.click("a.delayed-navigation"); // Clicking the link will indirectly cause a navigation
       frame.waitForURL("**\/target.html");
       
      Specified by:
      waitForURL in interface Frame
      Parameters:
      url - A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly equal to the string.
    • waitForURL

      public void waitForURL(Predicate<String> url, Frame.WaitForURLOptions options)
      Description copied from interface: Frame
      Waits for the frame to navigate to the given URL.

      **Usage**

      
       frame.click("a.delayed-navigation"); // Clicking the link will indirectly cause a navigation
       frame.waitForURL("**\/target.html");
       
      Specified by:
      waitForURL in interface Frame
      Parameters:
      url - A glob pattern, regex pattern or predicate receiving [URL] to match while waiting for the navigation. Note that if the parameter is a string without wildcard characters, the method will wait for navigation to URL that is exactly equal to the string.
    • waitForURL

      private void waitForURL(UrlMatcher matcher, Frame.WaitForURLOptions options)
    • waitForURLImpl

      void waitForURLImpl(Logger logger, UrlMatcher matcher, Frame.WaitForURLOptions options)
    • queryCount

      int queryCount(String selector)
    • highlightImpl

      void highlightImpl(String selector)
    • handleEvent

      protected void handleEvent(String event, com.google.gson.JsonObject params)
      Overrides:
      handleEvent in class ChannelOwner