docs: add Java requirements section (#148)

This commit is contained in:
Yury Semikhatsky 2020-12-18 12:01:47 -08:00 committed by GitHub
parent 259f2481bd
commit fc0c183eec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 36 deletions

View File

@ -16,6 +16,8 @@ Headless execution is supported for all the browsers on all platforms. Check out
## Usage ## Usage
Playwright supports Java 8 and above.
#### Add Maven dependency #### Add Maven dependency
Playwright is distributed as a set of [Maven](https://maven.apache.org/what-is-maven.html) modules. The easiest way to use it is to add a couple of dependencies to your Maven `pom.xml` file as described below. If you're not familiar with Maven please refer to its [documentation](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). Playwright is distributed as a set of [Maven](https://maven.apache.org/what-is-maven.html) modules. The easiest way to use it is to add a couple of dependencies to your Maven `pom.xml` file as described below. If you're not familiar with Maven please refer to its [documentation](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html).

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.playwright.example;
import com.microsoft.playwright.*;
import java.io.File;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) throws Exception {
Playwright playwright = Playwright.create();
Browser browser = playwright.chromium().launch();
BrowserContext context = browser.newContext(
new Browser.NewContextOptions().withViewport(800, 600));
Page page = context.newPage();
page.navigate("https://webkit.org");
page.click("text=check feature status");
page.screenshot(new Page.ScreenshotOptions().withPath(Paths.get("s.png")));
browser.close();
playwright.close();
}
}