fix 2: PlayWright-firstScript
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
package zacksolutions;
|
package zacksolutions;
|
||||||
|
|
||||||
|
|
||||||
import com.microsoft.playwright.Browser;
|
import com.microsoft.playwright.Browser;
|
||||||
import com.microsoft.playwright.Page;
|
import com.microsoft.playwright.Page;
|
||||||
import com.microsoft.playwright.Playwright;
|
import com.microsoft.playwright.Playwright;
|
||||||
@@ -10,13 +9,15 @@ import java.nio.file.Paths;
|
|||||||
|
|
||||||
public class BrowserLaunchTest {
|
public class BrowserLaunchTest {
|
||||||
@Test
|
@Test
|
||||||
public void browserLaunch(){
|
public void browserLaunch() {
|
||||||
try(Playwright playwright = Playwright.create()){
|
try (Playwright playwright = Playwright.create()) {
|
||||||
Browser browser = playwright.chromium().launch();
|
Browser browser = playwright.chromium().launch();
|
||||||
Page page = browser.newPage();
|
Page page = browser.newPage();
|
||||||
page.navigate("https://zenful.cloud");
|
page.navigate("https://zenful.cloud");
|
||||||
System.out.println(page.title());
|
System.out.println(page.title());
|
||||||
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("photo.png")));
|
page.screenshot(new Page.ScreenshotOptions().setPath(Paths.get("photo.png")));
|
||||||
|
page.type("input[id='message']", "4 8 15 16 23 42");
|
||||||
|
page.click("button");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user