Giter VIP home page Giter VIP logo

pic-diff-recognizer's Introduction

Pic-Diff-Recognizer

Selenium plugin library based on image difference recognition and page intelligent exploration.

The origin of this library is to make UI automatic testing no longer need to deal with page elements, but directly use real visual differences to judge whether the test results meet the expectations.

installation

pip install -r requirements.txt

pip install pic-diff-recognizer

best practice

from pic_diff_recognizer.searchHandler import SearchHandler
from violent_webdriver import Chrome
from selenium.webdriver.chrome.options import Options


# add some useful options :)
chrome_options = Options()
chrome_options.add_argument("--headless")
chrome_options.add_argument("disable-infobars")
chrome_options.add_experimental_option("excludeSwitches", ['enable-automation'])

# init driver , executable_path should be your own path!
dr = Chrome.violent_chromedriver(chrome_options=chrome_options,
                                 executable_path='/usr/local/bin/chromedriver')

# init searchHandler
search_handler = SearchHandler(browser=dr)

# search and saving baseline images in current directory named baseline
search_handler.traverse_href(origin_url='https://gitbook.cn/gitchat/author/5cea0bfbb78cc870612d8bba')

# -------------------- assuming after some iterations of current project -----------------------------

search_handler.url_histories = []

# load baseline images
search_handler.picture_handler.load_base_line()

# search and comparing screen shots and baseline images
search_handler.traverse_href(origin_url='https://gitbook.cn/gitchat/author/5cea0bfbb78cc870612d8bba',
                             compare_baseline_and_screen_shots=True)

# generate_diff_between_base_line_and_screen_shot and output diffResults to current directory
search_handler.picture_handler.generate_diff_between_base_line_and_screen_shot()

# output testReport.txt to current directory
search_handler.picture_handler.export_picture_comparison_result()

contact me

email address:[email protected]

pic-diff-recognizer's People

Contributors

amazingtest avatar

Watchers

James Cloos 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.