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
2,316 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,140 points
1,222 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,520 points
577 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 13, 2018 in Selenium by nsv999
• 5,500 points
5,869 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
25,654 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 7, 2018 by Omkar 79,497 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,500 points
7,953 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,500 points
16,986 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,500 points

edited Aug 4, 2023 by Khan Sarfaraz 4,383 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP