This guide shows you how to automatically capture screenshots of Flipkart product pages at set times, so you can track price changes over days or weeks without manually checking. You'll set up a free automation script that runs on your computer, takes a screenshot of a product URL, and saves it with a timestamp. This is useful for spotting price drops before you buy, or for seeing if a "deal" is actually a discount.
What You'll Need
- A computer running Windows, macOS, or Linux.
- Python 3.7 or newer installed (check with
python --version). - Google Chrome or Chromium browser installed.
- Basic comfort with a command line (Terminal on macOS/Linux, Command Prompt on Windows).
Step-by-Step
- Install required Python packages. Open your command line and run:
If you get a permission error, addpip install selenium schedule--userat the end. - Download the ChromeDriver. Go to the ChromeDriver download page (sites like chromedriver.chromium.org). Download the version that matches your Chrome browser (check Chrome's About page for the version number). Place the downloaded file in a folder you'll remember, e.g.,
C:\drivers\on Windows or/usr/local/binon macOS/Linux. - Create a new Python script. In a text editor (like Notepad or VS Code), create a file named
flipkart_tracker.py. - Write the script. Copy and paste the following code into the file:
from selenium import webdriver from selenium.webdriver.chrome.options import Options import schedule import time from datetime import datetimeList of product URLs to track
PRODUCT_URLS = [ "https://www.flipkart.com/your-product-1", "https://www.flipkart.com/your-product-2" ]Folder to save screenshots
SAVE_DIR = "screenshots" def take_screenshots(): # Create folder if it doesn't exist import os os.makedirs(SAVE_DIR, exist_ok=True) # Set up headless Chrome (runs in background) chrome_options = Options() chrome_options.add_argument("--headless") chrome_options.add_argument("--window-size=1920,1080") driver = webdriver.Chrome(executable_path="C:/drivers/chromedriver.exe", options=chrome_options) # Update path for your OS for url in PRODUCT_URLS: try: driver.get(url) time.sleep(3) # Wait for page to load timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") # Create a safe filename from URL safe_name = url.replace("https://www.flipkart.com/", "").replace("/", "_")[:30] filename = f"{SAVE_DIR}/{safe_name}_{timestamp}.png" driver.save_screenshot(filename) print(f"Saved: {filename}") except Exception as e: print(f"Error for {url}: {e}") driver.quit()Schedule: run every day at 9 AM and 9 PM
schedule.every().day.at("09:00").do(take_screenshots) schedule.every().day.at("21:00").do(take_screenshots) print("Scheduler started. Press Ctrl+C to stop.") while True: schedule.run_pending() time.sleep(60) - Update the script with your product URLs. Replace the placeholder URLs with the actual Flipkart product pages you want to track. You can add as many as you want, just keep them in quotes and separated by commas.
- Adjust the ChromeDriver path. In the line
webdriver.Chrome(executable_path="C:/drivers/chromedriver.exe", ...), change the path to where you placed the ChromeDriver. On macOS/Linux, it might look like"/usr/local/bin/chromedriver". - Run the script. In the command line, navigate to the folder containing your script and run:
The script will start and wait. It will take screenshots at the scheduled times. Keep the terminal window open (or run it in the background).python flipkart_tracker.py - Check the screenshots. After the first scheduled run, look in the
screenshotsfolder. You'll see PNG files named with the product and timestamp. Open them to see the price at that moment. - Compare prices over time. After a few days, sort the screenshots by filename (which includes the timestamp) and open them side by side to see how the price changed. You can also use image comparison tools or just manually note the prices.
Common Mistakes
- Wrong ChromeDriver version. If the driver doesn't match your Chrome version, you'll get a session error. Always download the matching version.
- Path errors. Using backslashes on Windows without escaping them (e.g.,
C:\drivers\chromedriver.exeinstead ofC:/drivers/chromedriver.exe). Use forward slashes or double backslashes. - Forgetting to update the URL list. The script only tracks the URLs you put in the list. If you add a new product later, you must edit the script and restart it.
- Closing the terminal. If you close the terminal window, the script stops. Use a process manager or run it in a separate session.
Tips
- Take screenshots more often during sale days. You can add more schedule lines, like
schedule.every().hour.do(...)to capture hourly changes during big sale events. - Use a cloud scheduler. If you want to run this without keeping your computer on, consider using a free cloud service like PythonAnywhere or a Raspberry Pi.
- Automate price extraction. Instead of just screenshots, you can modify the script to also extract the price text from the page using Selenium's
find_elementand save it to a CSV file for easier analysis. - Organize screenshots by product. Create a subfolder for each product by using the product name in the filename, as shown in the script.
Troubleshooting
- Script runs but no screenshots are saved. Check the console output for errors. Common causes: the ChromeDriver path is wrong, or the product page blocks automated access (you might see a CAPTCHA). If CAPTCHA appears, try adding a user-agent to the Chrome options:
chrome_options.add_argument("user-agent=Mozilla/5.0..."). - "chromedriver.exe" is not recognized. This means the path is incorrect. Double-check the path, and make sure the file is named exactly
chromedriver.exeon Windows. - Page loads but screenshot is blank. Increase the sleep time after
driver.get(url)to 5 or 10 seconds. Some pages load slowly, especially with many images. - Script stops after a few runs. This could be a memory issue. Restart the script daily using a task scheduler (like Task Scheduler on Windows or cron on macOS/Linux).
Frequently Asked Questions
Will this work on the Flipkart app?
No, this script works only in a web browser. It opens the website version of the product page.
Can I track prices without a computer running?
Yes, you can use a cloud server or a Raspberry Pi, but that requires additional setup. For a simple home solution, keep your computer on.
Is this against Flipkart's terms of service?
Automated access may violate their terms. Use it for personal, low-frequency tracking (a few times a day) to minimize impact. This guide is for educational purposes.
How do I know if a price is actually a discount?
Compare the current price with the price from a few days ago. If the price dropped, it's a real discount relative to that period. Also look for the original MRP (Maximum Retail Price) shown on the page.
What if the product page changes layout?
The screenshot will still capture the page, but the price might be in a different position. The script doesn't rely on layout, so it will still work, but you may need to visually locate the price.
Can I get an alert when the price drops?
Yes, you can modify the script to extract the price text and send an email or notification when it falls below a threshold. That's a more advanced version of this script.