I am trying to add cookies in playwright Java using browser Context in the playwright below is the code i am using
getURL(URL);
List<Cookie> ls = new ArrayList<Cookie>();
ls.add(new Cookie("JESSIONID",val));
context.addCookies(ls);
reload();
now while trying to run, it it is giving me below error:
com.microsoft.playwright.PlaywrightException: Error {
message='Cookie should have a URL or a domain/path pair
name='Error
stack='Error: Cookie should have a url or a domain/path pair
Even i also did this:
ls.add(new Cookie("JESSIONID",val,"path"));
This giving me compilation error saying you cannot add extra parameter in cookie
I am not able to add path in the cookie although it is the optional parameter
Can you guys please help how can i add path in the cookie constructors ;
Try this: