java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.WithinFrame

public class WithinFrame extends Object
Perform actions within an iframe.

Example usage:

 actor.attemptsTo(
     WithinFrame.locatedBy("#my-iframe")
         .click("#button-inside-frame")
 );

 // Or for complex operations:
 actor.attemptsTo(
     WithinFrame.locatedBy("#my-iframe")
         .perform(frame -> {
             frame.locator("#username").fill("user");
             frame.locator("#password").fill("pass");
             frame.locator("#submit").click();
         })
 );
 
  • Method Summary

    Modifier and Type
    Method
    Description
    net.serenitybdd.screenplay.Performable
    clear(String selector)
    Clear an input within the frame.
    net.serenitybdd.screenplay.Performable
    click(String selector)
    Click on an element within the frame.
    net.serenitybdd.screenplay.Performable
    fill(String selector, String value)
    Fill a value into an input within the frame.
    locatedBy(String frameSelector)
    Locate an iframe by its selector.
    net.serenitybdd.screenplay.Performable
    perform(Consumer<com.microsoft.playwright.FrameLocator> actions)
    Perform custom actions within the frame using the FrameLocator.
    net.serenitybdd.screenplay.Performable
    type(String selector, String text)
    Get text from an element within the frame.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • locatedBy

      public static WithinFrame locatedBy(String frameSelector)
      Locate an iframe by its selector.
    • click

      public net.serenitybdd.screenplay.Performable click(String selector)
      Click on an element within the frame.
    • fill

      public net.serenitybdd.screenplay.Performable fill(String selector, String value)
      Fill a value into an input within the frame.
    • clear

      public net.serenitybdd.screenplay.Performable clear(String selector)
      Clear an input within the frame.
    • type

      public net.serenitybdd.screenplay.Performable type(String selector, String text)
      Get text from an element within the frame.
    • perform

      public net.serenitybdd.screenplay.Performable perform(Consumer<com.microsoft.playwright.FrameLocator> actions)
      Perform custom actions within the frame using the FrameLocator.