Automating the Flipkart Experience with Selenium

1 minute read

Published:

Automating Flipkart Experience with Selenium

It is not easy to encounter login issues when automating web apps, and I know it really annoying. I came across this cool method to get over such problems it requires two things that are necessary. Recently, I stumbled on undetected_chromedriver. It is a great tool to automating web apps without flagging as a bot. I tried using it alongside download site cookies, and it worked like magic! There were no bot restrictions like captcha that I came across.
You can find my code here

In this Python script, we employ undetected_chromedriver, a specialized library for circumventing detection mechanisms, to orchestrate web automation using Selenium. The script begins by configuring ChromeOptions to operate in a non-headless mode, providing visibility into the browser actions. Subsequently, an instance of the undetected ChromeDriver, version 119, is initiated. The automation journey unfolds as the driver navigates to the Flipkart website and programmatically enters a specified phone number into the login form. Following this interaction, the script simulates a click on the login button. A deliberate time delay of 25 seconds allows the webpage to fully load, ensuring the subsequent steps are executed accurately. The cookies associated with the active session are then extracted and serialized into a binary file named “flipkartcookies3.pkl” using the Pickle module. Now it is easy to load back the cookies to visit site again and voila! you should be in without the login window blocking you.