Skip to content

Fix first Java script example and doc #1108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
package dev.selenium.getting_started;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.time.Duration;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

import io.github.bonigarcia.wdm.WebDriverManager;
Expand All @@ -31,11 +36,23 @@ public void quit() {
}

@Test
public void test() {
driver.get("https://google.com");
public void eightComponents() {
driver.get("https://duckduckgo.com/");

String title = driver.getTitle();
assertEquals("Google", title);
assertTrue(title.contains("DuckDuckGo"));

driver.manage().timeouts().implicitlyWait(Duration.ofMillis(500));

WebElement searchBox = driver.findElement(By.name("q"));
WebElement searchButton = driver.findElement(By.id("search_button_homepage"));

searchBox.sendKeys("Selenium");
searchButton.click();

searchBox = driver.findElement(By.name("q"));
String value = searchBox.getAttribute("value");
assertEquals("Selenium", value);
}

}
8 changes: 4 additions & 4 deletions website_and_docs/content/documentation/about/style.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ shortcode. This is an example of the `gh-codeblock` shortcode usage:

{{</* tabpane */>}}
{{</* tab header="Link" disableCodeBlock=true */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L15-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}
{{</* /tab */>}}
{{</* tab header="No Link" */>}}
This content should not get linked to GitHub
Expand All @@ -177,7 +177,7 @@ Which looks like this:

{{< tabpane >}}
{{< tab header="Link" disableCodeBlock=true >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L15-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
{{< /tab >}}
{{< tab header="No Link" >}}
This content should not get linked to GitHub
Expand Down Expand Up @@ -239,12 +239,12 @@ All code examples should be present and linked to in our example
With the `gh-codeblock` shortcode, it is possible to render code hosted in a GitHub
repository. This is an example of the `gh-codeblock` shortcode usage:

{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L15-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}

Which looks like this:

<span class="tab-pane">
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L15-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
</span>

### Consistent Heights
Expand Down
8 changes: 4 additions & 4 deletions website_and_docs/content/documentation/about/style.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ shortcode. This is an example of the `gh-codeblock` shortcode usage:

{{</* tabpane */>}}
{{</* tab header="Link" disableCodeBlock=true */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}
{{</* /tab */>}}
{{</* tab header="No Link" */>}}
This content should not get linked to GitHub
Expand All @@ -178,7 +178,7 @@ Which looks like this:

{{< tabpane >}}
{{< tab header="Link" disableCodeBlock=true >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
{{< /tab >}}
{{< tab header="No Link" >}}
This content should not get linked to GitHub
Expand Down Expand Up @@ -239,12 +239,12 @@ All code examples should be present and linked to in our example
With the `gh-codeblock` shortcode, it is possible to render code hosted in a GitHub
repository. This is an example of the `gh-codeblock` shortcode usage:

{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}

Which looks like this:

<span class="tab-pane">
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
</span>

### Code Comments
Expand Down
8 changes: 4 additions & 4 deletions website_and_docs/content/documentation/about/style.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ shortcode. This is an example of the `gh-codeblock` shortcode usage:

{{</* tabpane */>}}
{{</* tab header="Link" disableCodeBlock=true */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}
{{</* /tab */>}}
{{</* tab header="No Link" */>}}
This content should not get linked to GitHub
Expand All @@ -178,7 +178,7 @@ Which looks like this:

{{< tabpane >}}
{{< tab header="Link" disableCodeBlock=true >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
{{< /tab >}}
{{< tab header="No Link" >}}
This content should not get linked to GitHub
Expand Down Expand Up @@ -239,12 +239,12 @@ All code examples should be present and linked to in our example
With the `gh-codeblock` shortcode, it is possible to render code hosted in a GitHub
repository. This is an example of the `gh-codeblock` shortcode usage:

{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}

Which looks like this:

<span class="tab-pane">
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
</span>

### Code Comments
Expand Down
8 changes: 4 additions & 4 deletions website_and_docs/content/documentation/about/style.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ shortcode. This is an example of the `gh-codeblock` shortcode usage:

{{</* tabpane */>}}
{{</* tab header="Link" disableCodeBlock=true */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}
{{</* /tab */>}}
{{</* tab header="No Link" */>}}
This content should not get linked to GitHub
Expand All @@ -178,7 +178,7 @@ Which looks like this:

{{< tabpane >}}
{{< tab header="Link" disableCodeBlock=true >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
{{< /tab >}}
{{< tab header="No Link" >}}
This content should not get linked to GitHub
Expand Down Expand Up @@ -239,12 +239,12 @@ All code examples should be present and linked to in our example
With the `gh-codeblock` shortcode, it is possible to render code hosted in a GitHub
repository. This is an example of the `gh-codeblock` shortcode usage:

{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" */>}}
{{</* gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" */>}}

Which looks like this:

<span class="tab-pane">
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17-L37" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L38-L56" >}}
</span>

### Code Comments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ For more details on starting a session read our documentation on [opening and cl

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L30" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L6" >}}
Expand All @@ -44,7 +44,7 @@ In this example we are [navigating]({{< ref "/documentation/webdriver/browser/na

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L19" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L40" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L8" >}}
Expand All @@ -70,7 +70,7 @@ can request, including window handles, browser size / position, cookies, alerts,

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L21" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L42" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L10" >}}
Expand Down Expand Up @@ -104,7 +104,7 @@ Read more about [Waiting strategies]({{< ref "/documentation/webdriver/waits.md"

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L24" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L45" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L13" >}}
Expand All @@ -129,7 +129,7 @@ with one without first [finding an element]({{< ref "/documentation/webdriver/el

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L26-L27" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L47-L48" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L15-L16" >}}
Expand All @@ -154,7 +154,7 @@ but you will use them frequently.

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L29-L30" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L50-L51" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L18-L19" >}}
Expand All @@ -179,7 +179,7 @@ Notice that we need to relocate the search box because the DOM has changed since

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L33" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L54" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L22" >}}
Expand All @@ -205,7 +205,7 @@ No more commands can be sent to this driver instance.

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L36" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L35" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L25" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For more details on starting a session read our documentation on [opening and cl

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L17" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L30" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L6" >}}
Expand All @@ -45,7 +45,7 @@ In this example we are ブラウザが[ナビゲート]({{< ref "/documentation/

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L19" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L40" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L8" >}}
Expand All @@ -71,7 +71,7 @@ can request, including window handles, browser size / position, cookies, alerts,

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L21" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L42" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L10" >}}
Expand Down Expand Up @@ -105,7 +105,7 @@ Read more about [Waiting strategies]({{< ref "/documentation/webdriver/waits.md"

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L24" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L45" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L13" >}}
Expand All @@ -130,7 +130,7 @@ with one without first [finding an element]({{< ref "/documentation/webdriver/el

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L26-L27" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L47-L48" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L15-L16" >}}
Expand All @@ -155,7 +155,7 @@ but you will use them frequently.

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L29-L30" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L50-L51" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L18-L19" >}}
Expand All @@ -180,7 +180,7 @@ Notice that we need to relocate the search box because the DOM has changed since

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L33" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L54" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L22" >}}
Expand All @@ -206,7 +206,7 @@ No more commands can be sent to this driver instance.

{{< tabpane disableCodeBlock=true >}}
{{< tab header="Java" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L36" >}}
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L35" >}}
{{< /tab >}}
{{< tab header="Python" >}}
{{< gh-codeblock path="examples/python/tests/getting_started/test_first_script.py#L25" >}}
Expand Down
Loading