Created
July 3, 2019 13:28
-
-
Save adiohana/927e2859c54ffd95d12b89b0f7b767ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void verifyConsoleMessageAdded() { | |
String consoleMessage = "Hello Selenium 4"; | |
//enable Console | |
chromeDevTools.send(Console.enable()); | |
//add listener to verify the console message | |
chromeDevTools.addListener(Console.messageAdded(), consoleMessageFromDevTools -> | |
Assert.assertEquals(true, consoleMessageFromDevTools.getText().equals(consoleMessage))); | |
chromeDriver.get("https://apache.org"); | |
//execute JS - write console message | |
chromeDriver.executeScript("console.log('" + consoleMessage + "');"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment