From 71e2fb59c2f56cf321b670df7451dbaadd5a23f7 Mon Sep 17 00:00:00 2001 From: Sagar Date: Sun, 23 Jun 2024 15:00:08 +1000 Subject: [PATCH 1/4] Added README to run Java Examples (#1160) Also updated the first_script.en.md file with instructions to run first Java Example --- examples/java/src/test/java/README.md | 37 +++++++++++++++++++ .../getting_started/first_script.en.md | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 examples/java/src/test/java/README.md diff --git a/examples/java/src/test/java/README.md b/examples/java/src/test/java/README.md new file mode 100644 index 000000000000..c6e49649ab91 --- /dev/null +++ b/examples/java/src/test/java/README.md @@ -0,0 +1,37 @@ +# Running all tests from Selenium Java example + +Follow these steps to run all test example from selenium Java + +1. Clone this repository + +``` +git clone https://github.com/SeleniumHQ/seleniumhq.github.io.git +``` + +2. Navigate to `java` directory + +``` +cd seleniumhq.github.io/examples/java +``` + +3. Install dependencies using maven + +``` +mvn compile +``` + +4. Run all tests + +``` +mvn test +``` + +> Please keep some patience - If you are doing it for the first time, it will take a little while to verify and download the browser drivers + +# Execute a first Java example + +Use this command to run first Java Example + +``` +mvn exec:java -D"exec.mainClass"="dev.selenium.getting_started.FirstScript" -D"exec.classpathScope"=test +``` \ No newline at end of file diff --git a/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md b/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md index b7124efb122d..67ecec18d6ef 100644 --- a/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md +++ b/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md @@ -230,7 +230,7 @@ See [Quitting Sessions]({{< ref "../drivers/#quitting-sessions" >}}). {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< badge-code >}} +{{< gh-codeblock path="examples/java/README.md#L36" >}} {{< /tab >}} {{< tab header="Python" >}} {{< badge-code >}} From ef91a1b8dfb5e3a4f85ec7ec902a45351e9941a9 Mon Sep 17 00:00:00 2001 From: Sagar Date: Sun, 23 Jun 2024 15:54:03 +1000 Subject: [PATCH 2/4] moved the README file to correct path --- examples/java/{src/test/java => }/README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename examples/java/{src/test/java => }/README.md (100%) diff --git a/examples/java/src/test/java/README.md b/examples/java/README.md similarity index 100% rename from examples/java/src/test/java/README.md rename to examples/java/README.md From f1f5959d6afe89039272ae88005afb989274dd02 Mon Sep 17 00:00:00 2001 From: Sagar Date: Sun, 23 Jun 2024 16:59:34 +1000 Subject: [PATCH 3/4] corrected the maven command so that test classes will get compiled --- examples/java/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/java/README.md b/examples/java/README.md index c6e49649ab91..4208dc97d16c 100644 --- a/examples/java/README.md +++ b/examples/java/README.md @@ -15,9 +15,10 @@ cd seleniumhq.github.io/examples/java ``` 3. Install dependencies using maven +Ensure that JDK and Maven is installed on the system. ``` -mvn compile +mvn test-compile ``` 4. Run all tests From d82ef8aa8d69255d246998335bf9caef4a14a935 Mon Sep 17 00:00:00 2001 From: Sagar Date: Sun, 23 Jun 2024 20:28:02 +1000 Subject: [PATCH 4/4] updated the correct line number in first_script.en.md --- .../documentation/webdriver/getting_started/first_script.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md b/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md index 67ecec18d6ef..4334e581acd7 100644 --- a/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md +++ b/website_and_docs/content/documentation/webdriver/getting_started/first_script.en.md @@ -230,7 +230,7 @@ See [Quitting Sessions]({{< ref "../drivers/#quitting-sessions" >}}). {{< tabpane text=true >}} {{< tab header="Java" >}} -{{< gh-codeblock path="examples/java/README.md#L36" >}} +{{< gh-codeblock path="examples/java/README.md#L37" >}} {{< /tab >}} {{< tab header="Python" >}} {{< badge-code >}}