Skip to content

Commit 852503c

Browse files
committed
Update Information docs with new getDomAttribute() and getDomProperty() methods in java
1 parent 6c42f90 commit 852503c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

examples/java/src/test/java/dev/selenium/elements/InformationTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,17 @@ public void informationWithElements() {
5959

6060
// FetchAttributes
6161
// identify the email text box
62-
WebElement emailTxt = driver.findElement(By.name(("email_input")));
62+
WebElement emailTxt = driver.findElement(By.name("email_input"));
6363
// fetch the value property associated with the textbox
6464
String valueInfo = emailTxt.getAttribute("value");
65+
66+
// New in Selenium 4.27+
67+
// fetches the DOM attribute exactly as written in the HTML source
68+
String domAttribute = emailTxt.getDomAttribute("name");
69+
70+
// fetches the live property value from the DOM object (may differ at runtime)
71+
String domProperty = emailTxt.getDomProperty("name");
72+
6573
assertEquals(valueInfo,"admin@localhost");
6674

6775

website_and_docs/content/documentation/webdriver/elements/information.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ For this reason, Selenium has two precise methods to get these values: getDomAtt
261261

262262
{{< tabpane langEqualsHeader=true >}}
263263
{{< tab header="Java" text=true >}}
264-
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L64" >}}
264+
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L71" >}}
265265
{{< /tab >}}
266266
{{< tab header="Python" text=true >}}
267267
{{< gh-codeblock path="/examples/python/tests/elements/test_information.py#L44-L46" >}}

0 commit comments

Comments
 (0)