Handling cookies

Let's say you are automating the demo application. There could be many scenarios you want to automate, such as searching for products, adding products to the shopping cart, checkout, returns, and so on. For all these actions, one common thing is to have to log into the demo application in each of the test cases. So, logging into the application in every test case of yours will increase the overall test execution time significantly. To reduce the execution time of your test cases, you can actually skip signing in for every test case. This can be done by signing in once and writing all the cookies of that domain into a file. From the next login onward, you can actually load the cookies from the file and add them to the driver. ...

Get Learn Selenium now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.