import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals("refresh")) {
}
}
}
testImplementation 'javax.servlet:javax.servlet-api:3.0.1'
import com.codeborne.selenide.Selenide;
import org.openqa.selenium.Cookie;
import java.util.Set;
public class CookieExample {
public static void main(String[] args) {
Selenide.open("https://example.com/login");
Set<Cookie> cookies = Selenide.getWebDriver().manage().getCookies();
for (Cookie cookie : cookies) {
if (cookie.getName().equals("refresh")) {
String refreshToken = cookie.getValue();
System.out.println("Refresh Token: " + refreshToken);
}
}
}
}
dependencies {
implementation 'com.codeborne:selenide:6.10.0'
}