Skip to content

An automated script using Python and Behave to automate a guest shopper's journey on amazon.com

Notifications You must be signed in to change notification settings

bhadmus/behave-amazon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

behave-amazon

An automated script using Python and Behave to automate a guest shopper's journey on amazon.com

Tools and Framework Used.

  • Language: Python
  • Language version: 3.7.5
  • Selenium
  • brew
  • Webdriver: Chrome
  • Framework: Behave
  • Framework version: 1.2.6
  • IDE: Pycharm (Professional Edition)
  • OS: macOS (Catalina 10.15.4)

Installation and usage.

Installation and usage can be done via the terminal or used through the Pycharm IDE.

Using the Terminal

  • open terminal
  • Install python by running "brew install python3"
  • Install behave and selenium by running "pip3 install behave selenium"
  • Install chromedriver by running "brew cask install chromedriver"
  • Navigate to the folder cloned from git.
  • run >behave ./Features/guest_shopper.feature

Using the IDE

Create a Python Virtual environment.

So you can have an isolated working directory of the Python environment so as to keep the global Python free of installed dependencies. This ensures that the environment created only affects the project. This means the environment forms our project working directory.

STEPS:

  • Open terminal
  • Check if virtualenv is installed on the system: virtualenv --version.
  • If it is not installed, install using "pip3 install virtualenv".
  • If it is installed, go ahead and create a directory where the virtual environment will be located.
  • Navigate to the directory and create the new virtual environment. by using the command "virtualenv <name_of_environment>"
  • Install selenium with "pip install selenium"
  • Install behave with "pip install behave"
  • Copy this project into the environment
  • Activate the virtual environment by using source <name_of_environment>/bin/activate NB: To deactivate, just type deactivate and hit enter

Pycharm IDE

  • Install Pycharm (Professional Edition).
  • Open and navigate to the folder where this project has been copied and open it.
  • Click the Run Tab and click add/edit configuration.
  • Click the + and select Behave
  • Name the config
  • On the Feature files or folders, navigate to the Features folder of this project.
  • Ensure the virtualenv is being used as the interpreter.
  • Click Apply and OK.

Project Execution

Navigate into the Features folder and run "behave"

What does this script do?

Normally, we get on any e-commerce site to search for an item to buy online without bothering to sign in or register because we are excited. So we search for the item, add it to cart, the proceed to checkout. It is at this point that the system reminds us that we have to register or sign in before we can make a purchase on the site.

This simple script designed with Selenium, Python and Behave framework helps to capture that journey and verify that a user is redirected to the sign in or sign up page when the user gets to the point of checkout.

About

An automated script using Python and Behave to automate a guest shopper's journey on amazon.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published