POM idea of python + selenium automation framework

###################################

What are the features and advantages of using POM in Selenium?
1 ) POM is a design pattern that can help us maintain code and reduce code duplication. This is an important topic in the field of automated testing.
2 ) In the specific implementation, a page is regarded as a page object, and each page writes a class.
3 ) You can write all the positioning methods of the elements of a page and the business operation methods of the page in a class file, and then call the elements and methods of the page class in the test script class file. 
So there is a benefit, your software produced one interface has changed, you only need to modify the positioning of the corresponding page elements and related methods, without the need to modify your test scripts,
unless of course you are on this page demand, the following After being hacked, you have to modify your test script class.
4) In POM, we layer test scripts and page objects, for example, page objects are put under one package, test case scripts are put under another package, and the test script and page objects are separated.

 

########################################

 

 

##########################################

POM, Chinese: page object model, POM is a very popular automated testing model or idea in recent years, or POM is not a framework, but an idea to solve problems.
The purpose of adopting POM: In order to solve the frequent change of UI in the front end, resulting in the increasing cost of test automation script maintenance
POM idea: Separate page elements and business logic and test scripts into two different class files. class A only writes page element positioning and encapsulation of business logic code operations, class B only writes test scripts,
Don't care about element positioning, only write code that calls class A to cover different test scenarios. If the front-end page changes, you only need to modify the element positioning of Class A, instead of modifying the test script code in class B.
POM has the following advantages:
1. Separate web ui object warehouse from test script, business code and test script.
2. Each page corresponds to a page class, and the elements of the page are written into this page class.
3. The page class mainly includes the positioning of the elements of the page, and the method of encapsulating the business operation codes related to these elements.
4. Code reuse, thereby reducing the amount of test script code.
5. The level is clear, and it supports multiple writing automation script development, such as which pages each person writes, without affecting others.
6. It is recommended to give a meaningful name to the page class and business logic method, so that others can quickly write scripts and maintain scripts.

 

 

######################################

 

Guess you like

Origin www.cnblogs.com/andy0816/p/12721761.html