11
11
12
12
public class InformationTest {
13
13
14
- @ Test
15
- public void informationWithElements () {
16
-
17
- 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" );
14
+ @ Test
15
+ public void informationWithElements () {
21
16
22
- // isDisplayed
23
- // Get boolean value for is element display
24
- boolean isEmailVisible = driver . findElement ( By . name ( "email_input" )). isDisplayed ();
25
- assertEquals ( isEmailVisible , true );
17
+ 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" );
26
21
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 );
22
+ // isDisplayed
23
+ // Get boolean value for is element display
24
+ boolean isEmailVisible = driver .findElement (By .name ("email_input " )).isDisplayed ();
25
+ assertEquals (isEmailVisible , true );
31
26
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 );
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 );
36
31
37
- //TagName
38
- //returns TagName of the element
39
- String tagNameInp = driver .findElement (By .name ("email_input " )).getTagName ();
40
- assertEquals (tagNameInp , "input" );
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 );
41
36
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
-
60
- //FetchAttributes
61
- //identify the email text box
62
- WebElement emailTxt = driver .findElement (By .name (("email_input" )));
63
- //fetch the value property associated with the textbox
64
- String valueInfo = emailTxt .getAttribute ("value" );
65
- assertEquals (valueInfo ,"admin@localhost" );
66
-
67
-
68
- driver .quit ();
69
- }
37
+ // TagName
38
+ // Returns TagName of the element
39
+ String tagNameInp = driver .findElement (By .name ("email_input" )).getTagName ();
40
+ assertEquals (tagNameInp , "input" );
70
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
+ // Retrieves the computed style property 'font-size' of field
49
+ String cssValue = driver .findElement (By .name ("color_input" )).getCssValue ("font-size" );
50
+ assertEquals (cssValue , "13.3333px" );
51
+
52
+ // GetText
53
+ // Retrieves the text of the element
54
+ String text = driver .findElement (By .tagName ("h1" )).getText ();
55
+ assertEquals (text , "Testing Inputs" );
56
+
57
+ // FetchAttributes
58
+ // Identify the email text box
59
+ WebElement emailTxt = driver .findElement (By .name (("email_input" )));
60
+ // fetch the value property associated with the textbox
61
+ String valueInfo = emailTxt .getAttribute ("value" );
62
+ assertEquals (valueInfo , "admin@localhost" );
63
+
64
+ driver .quit ();
65
+ }
71
66
}
0 commit comments