Skip to content

Commit e1215de

Browse files
authored
Fix typos in two files (#1889)
In two files fixed typos and refactor the files. Co-authored-by: Diego Molina <[email protected]> [deploy site]
1 parent d82c9e8 commit e1215de

File tree

2 files changed

+64
-66
lines changed

2 files changed

+64
-66
lines changed

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

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,64 +8,64 @@
88
import org.openqa.selenium.chrome.ChromeDriver;
99
import java.time.Duration;
1010
import static org.junit.jupiter.api.Assertions.assertEquals;
11+
import static org.junit.jupiter.api.Assertions.assertTrue;
1112

1213
public class InformationTest {
1314

1415
@Test
1516
public void informationWithElements() {
16-
17+
1718
WebDriver driver = new ChromeDriver();
18-
driver.manage().timeouts().implicitlyWait(Duration.ofMillis(500));
19-
// Navigate to Url
20-
driver.get("https://www.selenium.dev/selenium/web/inputs.html");
21-
22-
// isDisplayed
23-
// Get boolean value for is element display
24-
boolean isEmailVisible = driver.findElement(By.name("email_input")).isDisplayed();
25-
assertEquals(isEmailVisible,true);
26-
27-
// isEnabled
28-
// returns true if element is enabled else returns false
29-
boolean isEnabledButton = driver.findElement(By.name("button_input")).isEnabled();
30-
assertEquals(isEnabledButton,true);
31-
32-
// isSelected
33-
// returns true if element is checked else returns false
34-
boolean isSelectedCheck = driver.findElement(By.name("checkbox_input")).isSelected();
35-
assertEquals(isSelectedCheck,true);
36-
37-
// TagName
38-
// returns TagName of the element
39-
String tagNameInp = driver.findElement(By.name("email_input")).getTagName();
40-
assertEquals(tagNameInp,"input");
41-
42-
// GetRect
43-
// Returns height, width, x and y coordinates referenced element
44-
Rectangle res = driver.findElement(By.name("range_input")).getRect();
45-
// Rectangle class provides getX,getY, getWidth, getHeight methods
46-
assertEquals(res.getX(),10);
47-
48-
49-
// Retrieves the computed style property 'font-size' of field
50-
String cssValue = driver.findElement(By.name("color_input")).getCssValue("font-size");
51-
assertEquals(cssValue, "13.3333px");
52-
53-
54-
// GetText
55-
// Retrieves the text of the element
56-
String text = driver.findElement(By.tagName("h1")).getText();
57-
assertEquals(text, "Testing Inputs");
58-
59-
19+
driver.manage().timeouts().implicitlyWait(Duration.ofMillis(500));
20+
// Navigate to Url
21+
driver.get("https://www.selenium.dev/selenium/web/inputs.html");
22+
23+
// isDisplayed
24+
// Get boolean value for is element display
25+
boolean isEmailVisible = driver.findElement(By.name("email_input")).isDisplayed();
26+
assertTrue(isEmailVisible);
27+
28+
// isEnabled
29+
// returns true if element is enabled else returns false
30+
boolean isEnabledButton = driver.findElement(By.name("button_input")).isEnabled();
31+
assertTrue(isEnabledButton);
32+
33+
// isSelected
34+
// returns true if element is checked else returns false
35+
boolean isSelectedCheck = driver.findElement(By.name("checkbox_input")).isSelected();
36+
assertTrue(isSelectedCheck);
37+
38+
// TagName
39+
// returns TagName of the element
40+
String tagNameInp = driver.findElement(By.name("email_input")).getTagName();
41+
assertEquals("input", tagNameInp);
42+
43+
// GetRect
44+
// Returns height, width, x and y coordinates referenced element
45+
Rectangle res = driver.findElement(By.name("range_input")).getRect();
46+
// Rectangle class provides getX,getY, getWidth, getHeight methods
47+
assertEquals(10, res.getX());
48+
49+
// Retrieves the computed style property 'font-size' of field
50+
String cssValue = driver.findElement(By.name("color_input")).getCssValue("font-size");
51+
assertEquals(cssValue, "13.3333px");
52+
53+
54+
// GetText
55+
// Retrieves the text of the element
56+
String text = driver.findElement(By.tagName("h1")).getText();
57+
assertEquals(text, "Testing Inputs");
58+
59+
6060
// FetchAttributes
6161
// identify the email text box
6262
WebElement emailTxt = driver.findElement(By.name(("email_input")));
6363
// fetch the value property associated with the textbox
6464
String valueInfo = emailTxt.getAttribute("value");
6565
assertEquals(valueInfo,"admin@localhost");
66-
67-
68-
driver.quit();
66+
67+
68+
driver.quit();
6969
}
7070

71-
}
71+
}

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

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.time.Duration;
99
import static org.junit.jupiter.api.Assertions.assertEquals;
1010

11-
public class InteractionTest{
11+
public class InteractionTest {
1212

1313
@Test
1414
public void interactWithElements() {
@@ -17,31 +17,29 @@ public void interactWithElements() {
1717
// Navigate to Url
1818
driver.get("https://www.selenium.dev/selenium/web/inputs.html");
1919

20-
// Click on the element
21-
WebElement checkInput=driver.findElement(By.name("checkbox_input"));
20+
// Click on the element
21+
WebElement checkInput = driver.findElement(By.name("checkbox_input"));
2222
checkInput.click();
23-
Boolean isChecked=checkInput.isSelected();
24-
assertEquals(isChecked,false);
23+
Boolean isChecked = checkInput.isSelected();
24+
assertEquals(isChecked, false);
2525

26-
//SendKeys
26+
// SendKeys
2727
// Clear field to empty it from any previous data
28-
WebElement emailInput=driver.findElement(By.name("email_input"));
28+
WebElement emailInput = driver.findElement(By.name("email_input"));
2929
emailInput.clear();
30-
//Enter Text
31-
String email="[email protected]";
32-
emailInput.sendKeys(email);
33-
//Verify
34-
String data=emailInput.getAttribute("value");
35-
assertEquals(data,email);
36-
37-
38-
//Clear Element
30+
// Enter Text
31+
String email = "[email protected]";
32+
emailInput.sendKeys(email);
33+
// Verify
34+
String data = emailInput.getAttribute("value");
35+
assertEquals(data, email);
36+
37+
// Clear Element
3938
// Clear field to empty it from any previous data
4039
emailInput.clear();
41-
data=emailInput.getAttribute("value");
42-
assertEquals(data, "");
40+
data = emailInput.getAttribute("value");
41+
assertEquals(data, "");
4342

4443
driver.quit();
4544
}
46-
4745
}

0 commit comments

Comments
 (0)