How do I keep a session alive for long Selenium scripts in automation

0 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 .

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()));                                                                                                    
}
Dec 16, 2020 in Selenium by AYUSHI
• 120 points
816 views

Hey, @

What browser are you using in this use case? That might be a critical piece of information to answer your question. If you're using Chrome or IE, what version of the binary driver did you register to the grid? 

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Selenium

+1 vote
1 answer

how do I escape the "/" in a textarea for Python3.7 with Selenium

@tchrisev, try using Robot class with following commands after your send_keys() ...READ MORE

answered Oct 29, 2019 in Selenium by Abha
• 28,060 points
353 views
0 votes
1 answer
+1 vote
2 answers

How do I make selenium check gmails quota storage and then execute another task in a new tab depending on the value?

Hi, Xpath.gettext try this if this doesn't work ...READ MORE

answered Oct 20, 2020 in Selenium by Roshni
• 10,480 points
193 views
0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 12, 2018 in Selenium by nsv999
• 5,520 points
4,194 views
0 votes
1 answer

How do I get current URL in Selenium Webdriver using Python?

Use current_url element. Example: print browser.current_url READ MORE

answered Aug 8, 2018 in Selenium by Meci Matt
• 9,460 points
22,780 views
+5 votes
4 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,450 points

edited Nov 6, 2018 by Omkar 44,397 views
+1 vote
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,520 points
5,608 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,520 points
12,263 views
0 votes
1 answer

Selenium JARS(Java) missing from downloadable link

Nothing to worry about here. In the ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,520 points
2,356 views