Can anyone please demonstrate to me how assertTrue() or assertFalse() methods work in Selenium?

0 votes
I am new to Selenium and trying to understand the concept of Assertions. So can anyone explain how assertTrue() or assertFalse() methods work for any web element?
May 15 in Selenium by Priyank

edited May 17 86 views

1 answer to this question.

0 votes

Hey Priyank, to understand how assertFalse() or assertTrue() works, please refer to the following code snippet:

package co.edureka.selenium.assertions;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.Assert;

public class AssertTrueFalse {

 public static void main(String[] args) {

        WebDriver driver = new ChromeDriver();


Here, assertFalse() will check the isSelected() methods output and if the output will be False, then only it will pass the test.

answered May 17 by Anvi
• 13,960 points

Related Questions In Selenium

0 votes
2 answers

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

You first need to download chrome driver ...READ MORE

answered Aug 26 in Selenium by Abha
• 27,180 points
0 votes
1 answer

What is the role of TestNG & JUnit frameworks in Selenium?

Well TestNG and JUnit are test frameworks ...READ MORE

answered Apr 18, 2018 in Selenium by king_kenny
• 3,650 points
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,110 points
0 votes
1 answer

Diff between WebDriver listeners and TestNG listeners?

This is not a very important concept ...READ MORE

answered Apr 13, 2018 in Selenium by king_kenny
• 3,650 points
0 votes
1 answer
0 votes
1 answer