This project automates interactions with the Booking.com website using Selenium WebDriver. It includes functionalities such as loading the homepage, setting the currency, searching for a destination, selecting check-in and check-out dates.
booking-automation/
│
├── booking/
│ ├── __init__.py
│ ├── booking.py
│ └── constants.py
├── requirements.txt
├── run.py
└── utils.py
-
booking/
- booking.py: Contains the main
Booking
class with methods to automate various actions on the Booking.com website. - constants.py: Stores constants used in the project, such as the base URL.
- init.py: Makes the
booking
directory a package.
- booking.py: Contains the main
-
requirements.txt: Lists the Python dependencies required to run the project.
-
run.py: The main script to run the booking automation.
-
utils.py: Contains utility functions, such as the function to start the WebDriver.
-
Clone the repository:
git clone https://github.com/Saalehh/Selenium-Python.git cd Selenium-Python
-
Set up a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Download the Edge WebDriver: Ensure you have the Edge WebDriver installed and it's compatible with your browser version. You can download it from here.
-
Modify the
constants.py
file: Ensure theBASE_URL
is set correctly:BASE_URL = "https://www.booking.com"
-
Run the automation script:
python run.py
The script will perform the following actions:
- Load the Booking.com homepage.
- Start dismissing any signup suggestions that appear.
- Set the currency to EUR.
- Search for "New York".
- Select check-in and check-out dates.
-
Setting Different Currency: Modify the currency code in
run.py
:bot.set_currency("EUR") # Change "EUR" to your desired currency code
-
Searching for a Different Place: Modify the place in
run.py
:bot.search_place_to_go("New York") # Change "New York" to your desired destination
-
Selecting Different Dates: Modify the dates in
run.py
:bot.select_dates("2024-05-20", "2024-05-23") # Change to your desired dates
This project is licensed under the MIT License - see the LICENSE file for details.