Class CaptureConsoleMessages
java.lang.Object
net.serenitybdd.screenplay.playwright.interactions.CaptureConsoleMessages
- All Implemented Interfaces:
net.serenitybdd.core.SkipNested,net.serenitybdd.screenplay.Performable
public class CaptureConsoleMessages
extends Object
implements net.serenitybdd.screenplay.Performable
Start capturing browser console messages for later analysis.
Console messages include logs, warnings, errors, and other output from JavaScript running in the browser.
Sample usage:
// Start capturing all console messages
actor.attemptsTo(CaptureConsoleMessages.duringTest());
// ... perform actions that generate console output ...
// Query captured messages
List<String> errors = actor.asksFor(ConsoleMessages.errors());
List<String> warnings = actor.asksFor(ConsoleMessages.warnings());
List<String> allMessages = actor.asksFor(ConsoleMessages.all());
// Clear captured messages
actor.attemptsTo(CaptureConsoleMessages.clear());
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a captured console message with its type, text, and location. -
Method Summary
Modifier and TypeMethodDescriptionstatic CaptureConsoleMessagesclear()Clear all previously captured console messages.static CaptureConsoleMessagesStart capturing console messages during the test.static StringGet the key used to store console messages in actor's memory.<T extends net.serenitybdd.screenplay.Actor>
voidperformAs(T actor) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.serenitybdd.screenplay.Performable
then
-
Method Details
-
duringTest
Start capturing console messages during the test. Messages will be stored and can be queried using ConsoleMessages questions. -
clear
Clear all previously captured console messages. -
performAs
public <T extends net.serenitybdd.screenplay.Actor> void performAs(T actor) - Specified by:
performAsin interfacenet.serenitybdd.screenplay.Performable
-
getConsoleMessagesKey
Get the key used to store console messages in actor's memory.
-