As we know Selenium is a tool used for controlling web browser through a program. It can be used in all browsers, OS and its program are written in various programming languages i.e Java, Python (all versions).
Selenium helps us automating any kind of task that we frequently do on our laptops, PC’s ranging from using facebook messenger for texting and WhatsApp also, daily tweeting tweets on twitter, wishing friends “Happy birthday” on Facebook, googling anything we want to learn and many more task. All these tasks can be automated using selenium in just a small implementation of it.
- Go to command prompt and put this is in:
pip install selenium
- Once that’s done, download a webdriver for automation. Here, we’ll use chromedriver from http://chromedriver.chromium.org/
Let’s learn how to automate the process of wishing a birthday wish on facebook friend’s timeline as a post.
The whole process of this automation can be divided as follows :
- Logging into Facebook application using credentials like Username and Password.
- Posting a “Happy Birthday” feed on timeline of those friends whose birthday is today.
Below are the steps:
- Create a browser object and using the
get()function to send a request to the website we want to connect/use.
- Find the elements like username and password input boxes, login button and using the selenium functions like
send_keys()etc to click on buttons and entering username and password respectively.
- After that using
get()function to send a request to /events/birthdays/ page.
- At the top of this page, there is a card of “Today’s Birthdays” which shows friend’s name whose birthday is today along with an input text box to enter any feed on their timeline.
- Using the XPATH of these input text boxes we will send our feed i.e., “Happy Birthday” using
send_keys()function of selenium.
- Close the browser.
NOTE: Make a separate
test.txt file and put your facebook password in it before the execution of the below program.
Below is the implementation:
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Automating the Machine Learning Pipeline for Credit card fraud detection
- Bulk Posting on Facebook Pages using Selenium
- Draw a happy face using Arcade Library in Python
- Birthday Reminder Application in Python
- Python | Whatsapp birthday bot
- Automatic Birthday mail sending with Python
- PyQt5 - Age Nearest Birthday Calculator
- Facebook Login using Python
- Facebook Sentiment Analysis using python
- GET and POST requests using Python
- Post a picture automatically on Instagram using Python
- Time Series Analysis using Facebook Prophet
- Share Price Forecasting Using Facebook Prophet
- Selenium Base Mini Project Using Python
- Python | SMS Bomber using Selenium
- Non blocking wait in selenium using Python
- How to access popup login window in selenium using Python
- Python | Automate Google Search using Selenium
- Python - Opening links using Selenium
- Flight-price checker using Python and Selenium
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet