fix 3: PlayWright-Tracing
This commit is contained in:
Generated
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -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")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user