Skip to main content

(For beginner to Python & Selenium)

This example is to build a custom bot using Selenium. Selenium is an automated testing bot.

In selenium you can use many programming languages, here we will try to learn Python as the testing language. I have always wanted to learn Python so this is a good opportunity.

  1. Install Python
  2. Install pip (installer using Python)( To easily install Selenium we need to install PIP)
  3. Install Selenium

Install Python

  • Install with all features if you are new to Python (see images above)
  • Check if Python is installed correctly.
  • Open Terminal as administrator.
    • Press CTRL-R or window key to bring out the search bar search “command prompt”, right-click to run as administrator.
  • in the terminal type
    • python –version
    • You should see something like “Python 3.10.4”

Install pip

  • Create an empty file get-pip.py file to use as a placeholder
  • Run this code to copy the pip code into the placeholder file
    • curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  • Run this code to run pip
    • python get-pip.py
  • Check PIP installed succesfully
    • pip –version

Install Selenium

  • Install (reference from the official site)
    • Run this command in command prompt
      • pip install selenium
      • python setup.py install

Install Selenium browser drivers

  • Then we need to download the Selenium browser driver
    • official link (if you can’t find the right version the next link can be useful)
      • IF you are going to use Chrome this could be useful: chromedrive link. Make sure you get the right version. The version that is higher than your Chrome version.
        • click on the triple dot in the top right corner > help > About google chrome or copy this in a chrome window
          • chrome://settings/help
    • Put the chromedriver somewhere you can easily access by code.
    • If you didn’t set up the Chromedriver path as seen in the official link then you just manually link it later inside your python code.
      • driver = webdriver.Chrome(executable_path=’C:/path/to/chromedriver.exe’)

Writing your first Selenium-Python bot buying Code

Buying playstation with an estore that needs login [ Reference site]

Download his sample code

  • cd playstation-bot
  • Can skip this if using windows
    • source bin/activate
  • python -m pip install -r requirements.txt
  • python app.py
    • Change the line code driver = webdriver() if you didnt setup the path for your chromedriver to this code:
      • driver = webdriver.Chrome(executable_path=’C:/path/to/chromedriver.exe’)

Ok from here you just need to study the python code and test and learn 😀

As I Am still learning I cant give useful ways to learn it and examples yet. Check-in after 3 months.


Leave a Reply