Skip to content
Advertisement

How to print failed assertions only without stack trace in soft assertAll() in Selenium?

Is there any way of printing just failed assertions without the entire stack trace when Selenium executes assertAll method?

JavaScript

So, say this snippet has two assertions either returns true and false. So assertAll() method returns as below.

JavaScript

What I want to see in the console log is like.

JavaScript

Thank you in advance.

Advertisement

Answer

You can use getMessage() method to print detail message instead of entire stack trace.

Code:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement