SELENIUM BASICS:


SELENIUM WEBDRIVER:


TESTNG:


REPORTS:


BUILD & CONTINUOUS INTEGRATION TOOLS:


CROSS BROWSER TESTING:


MOBILE TESTING:


AUTOMATION FRAMEWORKS:


API Testing:


INTERVIEW QUESTIONS:


SAMPLE RESUME:

Handling cookies in Selenium Python

In the previous articles on Selenium Python Tutorial, we have covered “How To Handle Web Tables in Selenium Python“. In this tutorial, we will learn Handling Cookies in Selenium Python. 

We can handle cookies with the help of Selenium WebDriver. A cookie refers to some details about our application which is saved by the browser. A cookie monitors the user actions within an application and stores them in the form of key value pairs. For example, login information of a visitor of a website.

We can create, modify, or delete a cookie with Selenium WebDriver to verify the characteristics of an application having and not having a cookie. Let us discuss some of the methods to handle cookies:

add_cookie (n) – This method is capable of adding cookie. The cookie to be added is passed as a parameter[n] to the method.

Syntax:

get_cookie (n) – This method is used to fetch a cookie with a name that is passed as a parameter[n] to the method.

Syntax:

get_cookies () – This method without parameter is used to fetch all the cookies from the active session.

Syntax:

delete_cookie (n) – This method is used to delete a cookie with a name that is passed as a parameter[n] to the method.

Syntax:

delete_all_cookies () – This method without parameter is used to delete all the cookies from the active session.

Syntax:

Code Implementation with cookie methods.

In the next article, we will learn Working with excel in Selenium Python

Related posts:

Sharing is caring.

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Like This Post?

We have a lot more where that came from?

We only send really good stuff occasionally, promise.

Rajkumar SM

Leave a Comment

Your email address will not be published. Required fields are marked *

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on whatsapp

Recent Posts:

Scroll to Top
API Testing eBook

DOWNLOAD FOR FREE