1. Browser commands such as to get and navigates to
2. Memory allocation in the driver as close or quit
3. Get values from a webpage using getText() and getAttribute("Attributevalue")
4. Verification of test case using Hard and Soft Assert
2. Browser Commands
driver.get(URL);
❖ Opens the browser and paste the URL. And wait for the URL to load
driver.getTitle();
❖ Fetches the Title of the current web page
driver.getCurrentUrl();
❖ Fetches the current URL from the browser
3. Browser Memory Allocation
driver= new ChromeDriver();
❖ Creates the browser instance object and allocates the memory
driver.close();
❖ Terminates the current browser window
driver.quit();
❖ Terminates all the browser window including the tabs if opened
4. Browser Navigation
driver.navigate().to(“”)
❖ Navigate to a url defined same as get. But it will not wait for the page to load
driver.navigate().back(“”)
❖ It acts as if a user click on back button in the browser
driver.navigate().forward(“”)
❖ It acts as if a user click on forward button in the browser
driver.navigate().refresh()
❖ It acts as if a user click on reload button in the browser
6. Verification statement
isDisplayed()
❖ Used to verify presence of a web element and returns pass or fail
isSelected()
❖ Used to verify whether the web element is selected or not. It is generally used
for checkbox and radio button verification
isEnabled()
❖ Used to verify whether the webElement is editable or not
7. Assert
❖ This command is the verification step in a test case
❖ I.e,. Expected and Actual Result will be verified in this Assert statements
❖ Two types are assertion
➢ Hard Assert
➢ Soft Assert
8. Hard Assert
❖ Verify when the test case is failed or not
❖ HardAssert will stop the execution when there is a failure
➢ AssertEquals
➢ AssertNotEquals
➢ AssertTrue
➢ AssertFalse
➢ AssertNull
➢ AssertNotNull
9. Hard Assert example
Assert.AssertFalse(condition);
This Assert will pass if condition is false
Assert.AssertTrue(condition);
This Assert will pass if condition is true
Assert.assertEquals(actual,expected);
This Assert will pass if both the actual and expected are same
Assert.assertNotEquals(actual,expected);
This Assert will pass if both the actual and expected are different
10. SoftAssert
Soft Assert will continue the execution of test case even if the test case is failed
With SoftAssert, We can check for multiple assertion in a single method or test
case
SoftAssert sa = new SoftAssert();
assertEquals : This method is used to verify the values are same or
not
assertNotEquals : Used to verify the values are different or not
11. SoftAssert
❖ Here the two values to verify can be of any datatype such as String, Float, int ,etc
❖ SoftAssert can also make the statement as fail using command
sa.fail();
❖ For SoftAssert, once all the assertion is added, it requires assertAll() to make
the test cases are pass or fail depending upon each assert statements
❖ In All Assert statements, we can provide a “Message” about the verification
sa.assertEquals("From UI","From addition","Verify whether
addition of values is true");