Sending cookies using Selenium WebDriver

0 votes

When I run my test script for the first time then I need to first login and then I can get into the desired web page. This happens each time I run the test, and this login page takes a lot of time to load. Is there a way where I can pass log in operation using Chrome or Firefox in Selenium WebDriver using Java language?

May 25, 2018 in Selenium by DareDev
• 6,890 points
1,357 views

1 answer to this question.

0 votes

You can create cookies using Java API as below:

Cookie cook = new Cookie("name", "value");
driver.manage().addCookie(cpok);

you can create cookies using the Python API as below:

driver.add_cookie({'name': 'foo', 'value': 'bar'})
answered May 25, 2018 by Meci Matt
• 9,460 points

Related Questions In Selenium

0 votes
1 answer

I tried to open a new website when a new tab is opened using Selenium Webdriver

Try this code: ArrayList<String> tabs = new ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
4,436 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
8,349 views
0 votes
1 answer

Double click a record in a grid using Selenium webdriver

Try Actions class to perform this Actions action ...READ MORE

answered Mar 30, 2018 in Selenium by Damon Salvatore
• 5,980 points
5,345 views
0 votes
1 answer
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
13,649 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,131 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
7,209 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,865 views
0 votes
1 answer
0 votes
1 answer
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