POM Documentation. Release Sergei Chipiga

Similar documents
webdriverplus Release 0.1

@AfterMethod

Selenium IDE. Steve Kwon, Raphael Huang, Amad Hussain, Mubasil Shamim

ActiveNET Enterprise Solution Company

Lab 5: Web Application Test Automation

Selenium. Duration: 50 hrs. Introduction to Automation. o Automating web application. o Automation challenges. o Automation life cycle

Zoho Integration. Installation Manual Release. 1 P a g e

UI cases Documentation

Java Programming Basics

Create and Manage Partner Portals

Guide for Windows users with Internet Explorer and Firefox

AUTOMATION TESTING FRAMEWORK FOR LUMINOUS LMS

behave-webdriver Documentation

Guide for Windows users with Internet Explorer and Firefox

RingCentral for Zendesk. UK Administrator Guide

Introduction to Automation. What is automation testing Advantages of Automation Testing How to learn any automation tool Types of Automation tools

Using VMware Identity Manager Apps Portal

Selenium Training. Training Topics

SELENIUM. Courses Offered. Ph: / Course Coverage:- Date:..Timings.. Duration Fees. Testing Tools QTP Load Runner Hadoop

Class 1 Introduction to Selenium, Software Test Life Cycle.

1. Selenium Integrated Development Environment (IDE) 2. Selenium Remote Control (RC) 3. Web Driver 4. Selenium Grid

Selenium Testing Course Content

Koenig Solutions Pvt. Ltd. Selenium with C#

CMS and e-commerce Solutions. version 1.0. Please, visit us at: or contact directly by

(Complete Package) We are ready to serve Latest Testing Trends, Are you ready to learn? New Batches Info

django-baton Documentation

*** Any Query *** Mail : 1. Introduction to Selenium. What is Selenium? Different automations tools. Selenium Automation Tools

Direct API Integration with QuickBase

etrac ATOM Android App Setup Guide

Golem Documentation. Luciano Puccio

NIELSEN API PORTAL USER REGISTRATION GUIDE

django-baton Documentation

Quick XPath Guide. Introduction. What is XPath? Nodes

Money Management Account

Selectively Cloning Courses in Moodle

PetExec s Owner Portal/Mobile App Setup Guide

SELENIUM. SELENIUM COMPONENTS Selenium IDE Selenium RC Selenium Web Driver Selenium Grid

Instructions on accessing your journal s content on your new app

SBCC Web File System - Xythos

Selenium Webdriver Github

Manual Testing. Software Development Life Cycle. Verification. Mobile Testing

Xpy4002-KX, Xpy4004-KX and Xpy8004-KX. setup with DDNS and mobile application

Selenium Testing Training

Infrastructure Trial User Guide

CMS and e-commerce Solutions. version 1.0. Please, visit us at: or contact directly by

OneLogin Integration User Guide

Testing Masters Technologies. Selenium FAQs

Prolog Converge Login

Connect-2-Everything SAML SSO (client documentation)

AppSpider Enterprise. Getting Started Guide

Evolve Link Proposal to [Institution] for ebooks ScienceDirect. for Brightspace by D2L

Toolium Documentation

GUJARAT TECHNOLOGICAL UNIVERSITY

SignNow 2.0 for Salesforce User Guide

EXPERT TRAINING PROGRAM [Selenium 2.0 / WebDriver]

SBI Mingle User Manual

Accounts FAQs. MONEY MANAGEMENT FAQs. Overview

SELENIUM TRAINING COURSE CONTENT

Test Plan Design Report

SeU Certified Selenium Engineer (CSE) Syllabus

ÓPTIMO User Quick Guide

[paf Wj] open source. Selenium 1.0 Testing Tools. Beginner's Guide. using the Selenium Framework to ensure the quality

Configuration Guide. Requires Vorex version 3.9 or later and VSA version or later. English

BLOOMBERG VAULT FOR FILES. Administrator s Guide

flask-jwt Documentation

CMS Enterprise Portal User Manual

IBM Website Monitoring Response Time

Golem Documentation. Luciano Puccio

How to add and manage aliases in Hotmail.com / Outlook.com

Testing => Good? Automated Testing => Better?

Paymode-X THE JOHNSON CONTROLS ELECTRONIC INVOICE MANAGEMENT TOOL. > Instructions for Invoicing Against a Purchase Order. Page 1

5. A small dialog window appears; enter a new password twice (this is different from Dori!) and hit Go.

Learning Management System. User guide for learners

Selenium Course Content

Managing User Account Passwords

STAAR Alternate 2 and TELPAS Assessment Management System User s Guide

Social Media Testing with Selenium

MYPLACE USER GUIDE User Guide for myplace.hexagon.com March 08, 2017

Install a LensMechanix network license

LIFX NodeServer Documentation

End-to-end testing with Selenium + Nightwatch.js

Guide to add as trusted site in Java 8 Update 51. Version of 24 OCBC Bank. All Rights Reserved

CMS and e-commerce Solutions

Using Xitracs Programs Module for Institutional Effectiveness Plans

Virto SharePoint Alerts Web Part v User and Installation Guide

django-sticky-uploads Documentation

Locate your Advanced Tools and Applications

Info Input Express Network Edition

TO ENABLE FINGERPRINT AUTHENTICATION

Changing passwords on Windows Customized for D-MTEC Users

Topic 16: Validation. CITS3403 Agile Web Development. Express, Angular and Node, Chapter 11

Sign-up Forms Builder for Magento 2.x. User Guide

October J. Polycom Cloud Services Portal

Drupal module for TagCommander Functional documentation

This is one of the common interview questions in any Automation testing job.

Oracle Big Data Cloud Service, Oracle Storage Cloud Service, Oracle Database Cloud Service

ConnectWise Integration

BHSF Physician User Guide

DaDaDocs for Microsoft Dynamics 365 Administrator Guide

The age of automation is going to be the age of 'do it yourself. - Marshall McLuhan

Transcription:

POM Documentation Release 1.0.2 Sergei Chipiga September 23, 2016

Contents 1 Annotation 1 2 Architecture 3 3 How to start 5 4 Supported components 7 4.1 App (base application class)....................................... 7 4.2 Page (base page class).......................................... 7 4.3 UI (base element class).......................................... 7 4.4 Button.................................................. 8 4.5 CheckBox................................................ 8 4.6 ComboBox................................................ 9 4.7 TextField................................................. 9 4.8 IntegerField................................................ 9 4.9 FileField................................................. 9 4.10 Form................................................... 9 4.11 Link.................................................... 9 4.12 List.................................................... 10 4.13 Table................................................... 10 4.14 Row.................................................... 10 4.15 Header.................................................. 10 4.16 Body................................................... 10 4.17 Footer................................................... 11 i

ii

CHAPTER 1 Annotation POM is Page-Object-Model microframework to develop web UI tests easy, quickly and with pleasure. 1

POM Documentation, Release 1.0.2 2 Chapter 1. Annotation

CHAPTER 2 Architecture POM provides API to manipulate with web UI elements and pages in browser. Under hood it uses selenium. Before to act with UI element POM waits for its visibility, because in user cases user can t interact with UI element if it isn t visible at display. POM provides tree hirarchy to request UI elements with UI caching mechanism at each level. POM doesn t use implicit_wait method to wait UI element, because implicit_wait waits until element is present at DOM even if it isn t visible. And also implicit_wait has conflict with caching mechanism, that leads to long requests in some cases. So POM has own implementation to wait element before interact. It leads to additinal webdriver request before interact with UI element, but provide reliable and simple architecture, without speed degradation. 3

POM Documentation, Release 1.0.2 4 Chapter 2. Architecture

CHAPTER 3 How to start Let imagine simple testcase: Go to https://facebook.com Fill login / password fields with admin / admin values Click button login Assert page to log in is opened Assert alert message is opened Its implementation with POM: import unittest import pom from pom import ui from selenium.webdriver.common.by import By @ui.register_ui(field_login=ui.textfield(by.name, 'email'), field_password=ui.textfield(by.name, 'pass')) class FormLogin(ui.Form): """Form to login.""" @ui.register_ui(form_login=formlogin(by.id, 'login_form')) class PageMain(pom.Page): """Main page.""" url = '/' @ui.register_ui( alert_message=ui.block(by.css_selector, 'div.uicontextuallayerpositioner')) class PageLogin(pom.Page): """Login page.""" url = '/login' @pom.register_pages([pagemain, PageLogin]) class Facebook(pom.App): """Facebook web application.""" def init (self): super(facebook, self). init ('https://www.facebook.com', 'firefox') 5

POM Documentation, Release 1.0.2 self.webdriver.maximize_window() self.webdriver.set_page_load_timeout(30) class TestCase(unittest.TestCase): def setup(self): self.fb = Facebook() self.addcleanup(self.fb.quit) def test_facebook_invalid_login(self): """User with invalid credentials can't login to facebook.""" self.fb.page_main.open() with self.fb.page_main.form_login as form: form.field_login.value = 'admin' form.field_password.value = 'admin' form.submit() assert self.fb.current_page == self.fb.page_login assert self.fb.page_login.alert_message.is_present To launch example: Save example code in file test_pom.py Install POM framework pip install python-pom Launch test example python -m unittest test_pom Full example of usage is in https://github.com/sergeychipiga/horizon_autotests. 6 Chapter 3. How to start

CHAPTER 4 Supported components 4.1 App (base application class) class pom.base.app(url, browser, *args, **kwgs) Web application. current_page Define current page open(url) Open url. Arguments: url: string. quit() Close browser. 4.2 Page (base page class) class pom.base.page(app) Page of web application. back(*args, **kwgs) Back. forward(*args, **kwgs) Forward. open(*args, **kwgs) Open page. refresh(*args, **kwgs) Refresh page. 4.3 UI (base element class) class pom.ui.base.ui(*locator, **index) Base class of ui element. 7

POM Documentation, Release 1.0.2 click(*args, **kwgs) Click ui element. clone() Clone ui element. double_click(*args, **kwgs) Double click ui element. get_attribute(*args, **kwgs) Get attribute of ui element. is_enabled Define is ui element enabled. is_present Define is ui element present at display. right_click(*args, **kwgs) Right click ui element. value Get value of ui element. wait_for_absence(*args, **kwgs) Wait for ui element absence. wait_for_presence(*args, **kwgs) Wait for ui element presence. webdriver Get webdriver. webelement Get webelement. 4.4 Button class pom.ui.button.button(*locator, **index) Button. 4.5 CheckBox class pom.ui.checkbox.checkbox(*locator, **index) Checkbox. is_selected Define is checkbox selected. select(*args, **kwgs) Select checkbox if it isn t selected. unselect(*args, **kwgs) Unselect checkbox if it is selected. 8 Chapter 4. Supported components

POM Documentation, Release 1.0.2 4.6 ComboBox class pom.ui.combobox.combobox(*locator, **index) Combobox. value Combobox value. values Combobox values. 4.7 TextField class pom.ui.fields.textfield(*locator, **index) Text field. value Value of text field. 4.8 IntegerField class pom.ui.fields.integerfield(*locator, **index) Integer field. value Value of integer field. 4.9 FileField class pom.ui.fields.filefield(*locator, **index) File field. value Value of text field. 4.10 Form class pom.ui.form.form(*locator, **index) Form. submit(*args, **kwgs) Submit form. 4.11 Link class pom.ui.link.link(*locator, **index) Link. 4.6. ComboBox 9

POM Documentation, Release 1.0.2 href URL of link. 4.12 List class pom.ui.table.list(*locator, **index) List. row(content) Get row of table. row_cls alias of Row 4.13 Table class pom.ui.table.table(*locator, **index) Table. row(**kwgs) Get row of table. row_cls alias of Row rows Table rows. 4.14 Row class pom.ui.table.row(*locator, **index) Row of table. cell_cls alias of Block 4.15 Header class pom.ui.table.header(*locator, **index) Header of table. cell_cls alias of Block 4.16 Body class pom.ui.table.body(*locator, **index) Table body. 10 Chapter 4. Supported components

POM Documentation, Release 1.0.2 columns Table columns. row(**kwgs) Get row of table. row_cls Row table class. row_xpath Row xpath. 4.17 Footer class pom.ui.table.footer(*locator, **index) Table footer. 4.17. Footer 11

POM Documentation, Release 1.0.2 12 Chapter 4. Supported components

Index A App (class in pom.base), 7 B back() (pom.base.page method), 7 Body (class in pom.ui.table), 10 Button (class in pom.ui.button), 8 C cell_cls (pom.ui.table.header attribute), 10 cell_cls (pom.ui.table.row attribute), 10 CheckBox (class in pom.ui.checkbox), 8 click() (pom.ui.base.ui method), 7 clone() (pom.ui.base.ui method), 8 columns (pom.ui.table.body attribute), 10 ComboBox (class in pom.ui.combobox), 9 current_page (pom.base.app attribute), 7 D double_click() (pom.ui.base.ui method), 8 F FileField (class in pom.ui.fields), 9 Footer (class in pom.ui.table), 11 Form (class in pom.ui.form), 9 forward() (pom.base.page method), 7 G get_attribute() (pom.ui.base.ui method), 8 H Header (class in pom.ui.table), 10 href (pom.ui.link.link attribute), 9 I IntegerField (class in pom.ui.fields), 9 is_enabled (pom.ui.base.ui attribute), 8 is_present (pom.ui.base.ui attribute), 8 is_selected (pom.ui.checkbox.checkbox attribute), 8 L Link (class in pom.ui.link), 9 List (class in pom.ui.table), 10 O open() (pom.base.app method), 7 open() (pom.base.page method), 7 P Page (class in pom.base), 7 Q quit() (pom.base.app method), 7 R refresh() (pom.base.page method), 7 right_click() (pom.ui.base.ui method), 8 Row (class in pom.ui.table), 10 row() (pom.ui.table.body method), 11 row() (pom.ui.table.list method), 10 row() (pom.ui.table.table method), 10 row_cls (pom.ui.table.body attribute), 11 row_cls (pom.ui.table.list attribute), 10 row_cls (pom.ui.table.table attribute), 10 row_xpath (pom.ui.table.body attribute), 11 rows (pom.ui.table.table attribute), 10 S select() (pom.ui.checkbox.checkbox method), 8 submit() (pom.ui.form.form method), 9 T Table (class in pom.ui.table), 10 TextField (class in pom.ui.fields), 9 U UI (class in pom.ui.base), 7 unselect() (pom.ui.checkbox.checkbox method), 8 13

POM Documentation, Release 1.0.2 V value (pom.ui.base.ui attribute), 8 value (pom.ui.combobox.combobox attribute), 9 value (pom.ui.fields.filefield attribute), 9 value (pom.ui.fields.integerfield attribute), 9 value (pom.ui.fields.textfield attribute), 9 values (pom.ui.combobox.combobox attribute), 9 W wait_for_absence() (pom.ui.base.ui method), 8 wait_for_presence() (pom.ui.base.ui method), 8 webdriver (pom.ui.base.ui attribute), 8 webelement (pom.ui.base.ui attribute), 8 14 Index