Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am automating a task with Selenium in which while automating long scripts my session got expired and the page automatically get jumped to login page , (Developer is maintaining page session for 60 minutes at server side) . Please guide me if there is any way to maintain the session for as long as my script keeps running .

I tried using using cookies but null is received in output , seems like it does not work for me .

What I have tried:

Java
driver.get(url);
Set<cookie> cookies =driver.manage().getCookies();

System.out.println("Cookies" + driver.manage().getCookies().toString());
for(Cookie ck : driver.manage().getCookies())                            
{ 	  	   System.out.println((ck.getName()+";"+ck.getValue()+";"+ck.getDomain()+";"+ck.getPath()+";"+ck.getExpiry()+";"+ck.isSecure()));                                                                                                    
}
Posted
Updated 16-Dec-20 2:16am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900