Code Monkey home page Code Monkey logo

automate-cookie-clicker-with-playwright's Introduction

Automate Cookie Clicker with Playwright


Welcome

Selenium is my favorite when I want to play around with web automation. This time, the framework I use for this kind of task is Playwright. Playwright is pretty new in the browser automation playground and is developed by Microsoft developers. I've been introduced to Playwright a couple of days ago and decided to test it by creating this small project.

Cookie Clicker is the chosen website for this project. I use Playwright to create a bot that navigates to this website, clicks on the cookie and buys any available upgrades.

Installation

Clone this project to your computer and install necessary dependencies. There are two ways you can install the dependencies.

  • First way: If you have pipenv already installed globally on your computer, you can type the following command in your terminal.
pipenv sync
  • Second way: If you prefer using pip, I also provide a requirements.txt file for you to install.
pip install -r requirements.txt

How to run

Before you can do anything, you have to run this command:

playwright install msedge

This will install Microsoft Edge on your computer since this project uses Edge to run automation. More details on how to install Playwright browsers.

Next, to the main thing, make sure you cd into the same directory level as main.py and type:

python main.py

This will spin up a new Microsoft Edge InPrivate window and automate all the game-playing tasks.

To run tests, simply type:

pytest

Change game-play settings

There is only one setting to change, it's GAMEPLAY_SESSION_MINUTES. It determines how long the automation runs before it ends in minutes. Currently, it is set to 5 minutes, you can change it to however you like. You can find this setting in the main.py file.

Enjoy! ๐Ÿ’ป

automate-cookie-clicker-with-playwright's People

Contributors

chau-ngoc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.