diff --git a/Playright/.idea/misc.xml b/Playright/.idea/misc.xml index 36cdbc1..e122dea 100644 --- a/Playright/.idea/misc.xml +++ b/Playright/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/Playright/src/test/java/zacksolutions/AWS.java b/Playright/src/test/java/zacksolutions/AWS.java new file mode 100644 index 0000000..67db8e0 --- /dev/null +++ b/Playright/src/test/java/zacksolutions/AWS.java @@ -0,0 +1,37 @@ +package zacksolutions; + +import com.microsoft.playwright.*; +import com.microsoft.playwright.options.*; +import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat; + +import java.nio.file.Paths; +import java.util.*; + +public class AWS { + public static void main(String[] args) { + try (Playwright playwright = Playwright.create()) { + + Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions() + .setHeadless(false)); + BrowserContext context = browser.newContext(); + // Start tracing before creating / navigating a page. + context.tracing().start(new Tracing.StartOptions() + .setScreenshots(true) + .setSnapshots(true) + .setSources(true)); + Page page = context.newPage(); + page.navigate("https://aws.amazon.com/"); + page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Sign In")).click(); + page.getByLabel("Account ID (12 digits) or").click(); + page.getByLabel("Account ID (12 digits) or").fill("123"); + page.getByLabel("IAM username").click(); + page.getByLabel("IAM username").fill("dev"); + page.getByTestId("password").getByLabel("Password").click(); + page.getByTestId("password").getByLabel("Password").fill("passw"); + + // Stop tracing and export it into a zip archive. + context.tracing().stop(new Tracing.StopOptions() + .setPath(Paths.get("trace.zip"))); + } + } +} diff --git a/Playright/trace.zip b/Playright/trace.zip new file mode 100644 index 0000000..86b57db Binary files /dev/null and b/Playright/trace.zip differ