How do I inject cookies into a test with Java-TestNG?

How do I inject cookies into a test with Java-TestNG?

Hello Charity,

You can use the below command to add the cookies.

// Adds the cookie into current browser context
driver.manage().addCookie(new Cookie(""key"", ""value""));