GithubHelp home page GithubHelp logo

navaz-alani / selenium-testing-module Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 15 KB

A set of functions which automate browser initiation (download & install webdriver) and prettify logging for Selenium.

License: MIT License

Python 100.00%
selenium-testing webdriver chromium

selenium-testing-module's Introduction

Selenium Testing Module

This module contains a set of functions which automate browser initiation and prettify logging for Selenium.

Motivation

When using Selenium WebDriver to automate E2E testing, one needs a driver which Selenium can use to control the browser. In the case of Google Chrome, its the chromedriver.

Getting the driver and setting it up is usually manual and is somewhat error prone.

What this module offers

This module offers the browser_init function which can be used as follows:

browser_init : browser_name: str, ops=[], exp_ops=[], headless_download=False) -> WebDriver

Arguments:

browser_init takes the following arguments:

  • REQUIRED: browser_name: str - one of "firefox", "chrome", "edge","gecko", "opera_chromium", "opera"
  • ops: list = [] - options such as "headless", "verbose"
  • exp_ops: list = [] - experimental options
  • headless_download: bool = False - This is a feature which is aimed at working around the chromium sercurity feature prohibiting downloads in headless mode. Set True to download in headless mode.

and returns a WebDriver object.

Also offered is the p_print function which can be used to prettify command line output so that tests can be understood by the greater team.

p_print takes in the following arguments:

  • REQUIRED: s: any - object to print
  • n: int = 0 - This is the parameter specifying the indent level of the output
  • toc: str = None - Token which can be used to color the output. Use token 'info' for yellow, 's' for green (success) and 'f' for red (failure).

returns None and outputs to stdout.

Finally, user_exit is a debug function that can be used to prevent the driver from closing when the test script execution complete. It prompts the user to close the session. It should be executed as the last command in the script.

user_exit takes in 1 argument:

REQUIRED: driver: WebDriver - a WebDriver object

returns None and prompts the user to exit test manually.

selenium-testing-module's People

Contributors

navaz-alani avatar

Watchers

 avatar  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.